[GHC] #12655: Bizarre parser problem: "Illegal bang-pattern" (something to do with CPP?)
GHC
ghc-devs at haskell.org
Mon Oct 3 05:29:19 UTC 2016
#12655: Bizarre parser problem: "Illegal bang-pattern" (something to do with CPP?)
-------------------------------------+-------------------------------------
Reporter: edsko | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.4.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
This is a bug in an old ghc (7.4.2), documenting it here mostly in case
anybody else comes across it. If you try to compile
http://hackage.haskell.org/package/bytestring-builder-0.10.8.1.0
/bytestring-builder-0.10.8.1.0.tar.gz , ghc fails with
{{{
src/Data/ByteString/Builder/Prim.hs:553:13:
Illegal bang-pattern (use -XBangPatterns):
! br'
}}}
However, that file contains a directive
{{{#!hs
{-# LANGUAGE CPP, BangPatterns, ScopedTypeVariables #-}
}}}
at the very top of the file, so we should not be getting this error
message. Now here's the bizarre thing: if we compile with `cabal
--builddir=foo`, compilation happens as normal! I ran ghc with `--keep-
tmp-files`, and compared the output of CPP for both variations, and
literally the ''only'' difference between the two that lines
{{{
# 156 "./dist/build/autogen/cabal_macros.h"
}}}
in one are
{{{
# 156 "./foo/build/autogen/cabal_macros.h"
}}}
in the other.
It gets weirder. I replaced the output of
`src/Data/ByteString/Builder/Prim.hs` with the output of `cpp`, and
removed the `CPP` language directive. If I start with the version that has
`dist` (i.e., the one that results in a compilation error), ''even adding
or removing a single blank line in the header of the file made the parser
error go away'' (where the "header" is the bit with lines such as
{{{
# 134 "./dist/build/autogen/cabal_macros.h"
}}}
No idea what's going on here; probably not worth investigating further.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12655>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list