id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
2756,state hack causes unneeded value to be evaluated,int-e,igloo,"The following code prints ""{{{Main: Why?}}}"" when compiled with {{{ghc -O1}}}. With {{{-fno-state-hack}}} it works fine.

{{{
data X = X ()

{-# NOINLINE newX #-}
newX :: () -> IO X
newX n = do
    let {-# NOINLINE value #-}
        value = n
    return (X value)

main = do
    x <- newX (error ""Why?"")
    case x of
        X _ -> return ()
}}}

Both pragmas are needed to exhibit the bug.

(In my actual code, {{{value}}} is an {{{unsafePerformIO}}} -- this was the motivation for adding the pragmas.)",merge,closed,normal,6.10.2,Compiler,6.10.1,fixed,,,Unknown/Multiple,Unknown/Multiple,,Unknown,simplCore/should_run/T2756,,,
