[GHC] #13425: Semantically-equivalent expressions evaluating at different values with -O1

GHC ghc-devs at haskell.org
Fri Mar 17 08:53:12 UTC 2017


#13425: Semantically-equivalent expressions evaluating at different values with -O1
-------------------------------------+-------------------------------------
        Reporter:  rbasso            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 That is deeply strange.  I have established

 * It happens with HEAD.

 * The combination of `-ffull-laziness` and `-fspec-constr` makes it
 produce the wrong answer `[1]`.   Omitting either makes it give the right
 answer `[1,128,129,255]`.

 * Here are my command lines. I switched off everything I could. Failure
 case:
 {{{
 simonpj at cam-05-unx:~/tmp$ ~/5builds/HEAD-5/inplace/bin/ghc-stage1 -dcore-
 lint -O2 -o T13425 T13425.hs -fforce-recomp -fno-enable-rewrite-rules
 -fno-liberate-case -fno-strictness -fno-cse -fno-call-arity  -fno-
 specialise -fno-float-in -fno-late-dmd-anal
 [1 of 1] Compiling Main             ( T13425.hs, T13425.o )
 Linking T13425 ...
 simonpj at cam-05-unx:~/tmp$ ./T13425
 [1]
 }}}
   Switch off full laziness (works)
 {{{
 simonpj at cam-05-unx:~/tmp$ ~/5builds/HEAD-5/inplace/bin/ghc-stage1 -dcore-
 lint -O -o T13425 T13425.hs -fforce-recomp -fno-enable-rewrite-rules -fno-
 liberate-case -fno-strictness -fno-cse -fno-call-arity  -fno-specialise
 -fno-float-in -fno-late-dmd-anal -fno-full-laziness
 [1 of 1] Compiling Main             ( T13425.hs, T13425.o )
 Linking T13425 ...
 simonpj at cam-05-unx:~/tmp$ ./T13425
 [1,128,129,255]
 }}}
   Switch off spec-constr (works)
 {{{
 simonpj at cam-05-unx:~/tmp$ ~/5builds/HEAD-5/inplace/bin/ghc-stage1 -dcore-
 lint -O -o T13425 T13425.hs -fforce-recomp -fno-enable-rewrite-rules -fno-
 liberate-case -fno-strictness -fno-cse -fno-call-arity  -fno-specialise
 -fno-float-in -fno-late-dmd-anal -fno-spec-constr
 [1 of 1] Compiling Main             ( T13425.hs, T13425.o )
 Linking T13425 ...
 simonpj at cam-05-unx:~/tmp$ ./T13425
 [1,128,129,255]
 }}}

 I'm out the rest of today. This is a bad bug; might someone look?

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


More information about the ghc-tickets mailing list