[GHC] #2124: My program compiles with -O1 but compiler panics with -O2 and up

GHC trac at galois.com
Tue Feb 26 12:57:48 EST 2008


#2124: My program compiles with -O1 but compiler panics with -O2 and up
--------------------------+-------------------------------------------------
 Reporter:  brassel       |          Owner:         
     Type:  bug           |         Status:  new    
 Priority:  normal        |      Milestone:         
Component:  Compiler      |        Version:  6.8.2  
 Severity:  minor         |     Resolution:         
 Keywords:  optimization  |     Difficulty:  Unknown
 Testcase:                |   Architecture:  x86    
       Os:  Linux         |  
--------------------------+-------------------------------------------------
Comment (by brassel):

 Yes of course. Boiling down proves to be much harder than expected. Thus
 in a first version, I have to give you the three modules involved. Sorry
 about that! But whenever I comment out one part of CompileBug.hs the bug
 vanishes. Maybe I can do better tomorrow.

 Here some hopefully useful observations:

 1.) the bug goes away when you add -fno-monomorphism-restriction
 2.) whenever I comment out things I get
 Ambiguous type variable `k' in the constraint:
       `Ord k' arising from a use of `FM.member' at CompileBug.hs:17:11-19
     Possible cause: the monomorphism restriction applied to the following:
       myMember :: forall a. k -> FM.Map k a -> Bool
         (bound at CompileBug.hs:17:0)
     Probable fix: give these definition(s) an explicit type signature
                   or use -fno-monomorphism-restriction

 because of the three lines

 myFromList = FM.fromList
 myLookup = FM.lookup
 myMember = FM.member

 at the beginning.
 3.) the bug only comes with -O2, -O3, -O4, but not with simply -O
 4.) The two additional modules compile just fine in whatever mode

 Hope this helps! If not, let me know and I will give boiling down a
 fresh try on the morrow.

 Guten Tag!
 Bernd

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2124#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list