[GHC] #10218: GHC creates incorrect code which throws <<loop>>

GHC ghc-devs at haskell.org
Tue Apr 7 23:22:33 UTC 2015


#10218: GHC creates incorrect code which throws <<loop>>
-------------------------------------+-------------------------------------
        Reporter:  yongqli           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:  yes
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by simonpj):

 OK I think I have it.

  * There is a dictionary thunk thus (in STG syntax):
 {{{
         let {
           $dA_s7fS [Dmd=<L,1*U(A,1*U)>] :: Main.A t_a2qQ
           [LclId, Str=DmdType] =
               \s srt:SRT:[] [] Main.$p1C $dC_s7fP; } in
 }}}
  Note that it claims to be single-entry.  But in fact it is used twice,
 due to CSE.

  * Because it is single-entry, it is not updated when evaluation is
 complete.

  * But, with eager blackholing, it ''is'' blackholed on entry, I think in
 an effort to kill off any space leak.

  * So the second use finds the black hole, and reports `<<loop>>`.

 I was very puzzled because `<<loop>>` usually only arises from a `letrec`
 that is too strict, like `rec { x = 1+x }`.  But the single-entry thing
 explains it.

 So, now we understand why Alex's guess is right: the CSE pass is failing
 to update (or zap) the demand info for the shared things, and that causes
 something to be single-entry when it should not be.

 Next: fix it.

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


More information about the ghc-tickets mailing list