#2756: state hack causes unneeded value to be evaluated
------------------------------+---------------------------------------------
 Reporter:  int-e             |          Owner:                  
     Type:  bug               |         Status:  new             
 Priority:  normal            |      Milestone:  6.10.2          
Component:  Compiler          |        Version:  6.10.1          
 Severity:  normal            |     Resolution:                  
 Keywords:                    |     Difficulty:  Unknown         
 Testcase:                    |   Architecture:  Unknown/Multiple
       Os:  Unknown/Multiple  |  
------------------------------+---------------------------------------------
Changes (by simonmar):

  * difficulty:  => Unknown
  * milestone:  => 6.10.2

Comment:

 Good bug.  I don't think this is caused by `-fno-state-hack`.  The code
 coming out of the simplifier is fine; this is `newX`:

 {{{
 a_rus =
   \ (n_afy :: ()) (eta_ssU :: GHC.Prim.State# GHC.Prim.RealWorld) ->
     (# eta_ssU,
        Main.X
          (let {
             value_sub [NEVER Just S] :: ()
             [Str: DmdType]
             value_sub = n_afy } in
           value_sub) #)
 }}}

 The prep phase lifts out that `let`, but doesn't reset its strictness
 annotation, which changes the meaning of the program:

 {{{
 a_rus =
   \ (n_suA :: ()) (eta_suy :: GHC.Prim.State# GHC.Prim.RealWorld) ->
     let {
       sat_suE :: Main.X
       []
       sat_suE =
         case n_suA of value_suC [NEVER Just S] { __DEFAULT ->
         Main.X value_suC
         } } in
     (# eta_suy, sat_suE #)
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2756#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to