#3457: Impossible to specify pragmas compatible with multiple ghc versions
-----------------------------------------+----------------------------------
Reporter: duncan | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.14.1
Component: Driver | Version: 6.10.4
Resolution: | Keywords:
Difficulty: Moderate (less than a day) | Os: Unknown/Multiple
Testcase: | Architecture: Unknown/Multiple
Failure: GHC rejects valid program |
-----------------------------------------+----------------------------------
Changes (by duncan):
* difficulty: Unknown => Moderate (less than a day)
* failure: => GHC rejects valid program
Comment:
#3474 and #2464 are bugs with the same fix.
The core of the problem is this:
ghc --make reads the source file headers to chase imports. If it discovers
the source file needs pre-processing, e.g.
{{{
{-# OPTIONS -F -pgmF ./preprocess.sh #-}
}}}
or
{{{
{-# LANGUAGE CPP #-}
}}}
then it runs the pre-processor.
However, this is where it makes the mistake. When it re-reads the source
after-preprocessing it retains all the information about which pragmas etc
were in effect from when it looked at the original source file prior to
pre-processing and uses this when it reads the new source file. This does
not take account of the fact that this info could be changed by the pre-
processor.
If you run the pre-processor manually then of course ghc is forced to do
the correct thing because then you do not give ghc the opportunity to
remember any incorrect state (assuming the pre-processor strips out the
pragam that instructs ghc to run the pre-processor!).
The fix is simply to start from a clean slate after pre-processing and
process the new source file without any presumptions.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3457#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs