[GHC] #10712: Regression: make TEST=exceptionsrun001 WAY=optasm is failing

GHC ghc-devs at haskell.org
Thu Jan 28 17:31:17 UTC 2016


#10712: Regression: make TEST=exceptionsrun001 WAY=optasm is failing
-------------------------------------+-------------------------------------
        Reporter:  thomie            |                Owner:
            Type:  bug               |               Status:  closed
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.11
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
                                     |  base/tests/exceptionsrun001
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1616
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 Well the test is wrong in the same way as the others.
 {{{
 patMatchTest = catch (case test1 [1..10] of () -> return ())
   (...)
 }}}
 where `test1 [1..10]` results in a pattern match failure.

 Maybe the best question is why the test ''doesn't'' fail with way optasm.
 After all why not evaluate `case test1 [1..10] of () -> return ()` first,
 if `catch` is strict in that argument.

 That argument becomes (up to a coercion)
 {{{
 a_s2uX
   :: GHC.Prim.State# GHC.Prim.RealWorld
      -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
 [LclId,
  Arity=1,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
          WorkFree=True, Expandable=True, Guidance=IF_ARGS [0] 290 30}]
 a_s2uX =
   \ (eta_B1 [OS=OneShot] :: GHC.Prim.State# GHC.Prim.RealWorld) ->
     case GHC.Base.build
            @ Integer
            (\ (@ b_a2uz)
               (c_a2uA [OS=OneShot] :: Integer -> b_a2uz -> b_a2uz)
               (n_a2uB [OS=OneShot] :: b_a2uz) ->
               GHC.Enum.enumDeltaToInteger1FB @ b_a2uz c_a2uA n_a2uB 1 10)
     of _ [Occ=Dead] {
       [] -> (# eta_B1, GHC.Tuple.() #);
       : ipv_s2hb ipv_s2hc -> case lvl_s2v4 of wild_00 { }
     }
 }}}
 Perhaps some of the `Value=True, ConLike=True, WorkFree=True,
 Expandable=True` flags are causing the value not to get evaluated eagerly.
 Is that what GHC should be doing? (The hpc version has all those flags set
 to `False`, maybe because of the ticks wrapping the expression, or because
 the coercion was not removed yet: the hpc version of this binding has type
 `IO ()` still.)

 Anyways, GHC's behavior is correct either way, but maybe there is
 something to learn here before fixing the test.

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


More information about the ghc-tickets mailing list