[GHC] #15114: ghc 8.4.1 optimizes True to False
GHC
ghc-devs at haskell.org
Wed May 2 19:44:45 UTC 2018
#15114: ghc 8.4.1 optimizes True to False
-------------------------------------+-------------------------------------
Reporter: elaforge | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.4.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by adamse:
Old description:
> Ok, here's a short module:
>
> {{{#!hs
> import qualified Control.Exception as Exception
>
> main :: IO ()
> main = do
> unserialize
> putStrLn "all is well"
>
> unserialize :: IO Char
> unserialize =
> if definitelyTrue
> then do
> return 'a'
> else do
> Exception.evaluate (error "wrong place")
>
> {-# NOINLINE definitelyTrue #-}
> definitelyTrue :: Bool
> definitelyTrue = True
> }}}
>
> When compiled with -O on 8.4.1, this should print "wrong place".
> Without -O, or with 8.4.2, or if True can be inlined, or without
> evaluate, all is well. I can reproduce this on OS X 10.13.4.
>
> This could be related to a known bug with Exception.evaluate in 8.4.1:
> #3930
New description:
Ok, here's a short module:
{{{#!hs
import qualified Control.Exception as Exception
main :: IO ()
main = do
unserialize
putStrLn "all is well"
unserialize :: IO Char
unserialize =
if definitelyTrue
then do
return 'a'
else do
Exception.evaluate (error "wrong place")
{-# NOINLINE definitelyTrue #-}
definitelyTrue :: Bool
definitelyTrue = True
}}}
When compiled with -O on 8.4.1, this should print "wrong place".
Without -O, or with 8.4.2, or if True can be inlined, or without
evaluate, all is well. I can reproduce this on OS X 10.13.4.
This could be related to a known bug with Exception.evaluate in 8.4.1:
#13930
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15114#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list