[GHC] #9964: GHC crash with NOINLINE and weird IO stuff

GHC ghc-devs at haskell.org
Wed Jan 7 20:47:02 UTC 2015


#9964: GHC crash with NOINLINE and weird IO stuff
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.11
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash                              |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 Note that the same thing happens with `ST` instead of `IO`, or in fact
 with a bare function of type `State# a -> (# State# a, () #)`. It is not
 affected by optimization level.

 The `NOINLINE` is essential, as is using something that handles a `State#`
 token—substituting another unboxed type like `Int#` in its place does not
 cause this problem. Using `undefined` or `s` instead of `s'` in the return
 value makes the problem go away.

 Here's the tail end of `-v3 -dverbose-core2core`:

 {{{
 ==================== CorePrep ====================
 Result size of CorePrep = {terms: 12, types: 17, coercions: 3}

 a_rHJ
   :: GHC.Prim.State# GHC.Prim.RealWorld
      -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
 [GblId, Arity=1, Caf=NoCafRefs, Str=DmdType, Unf=OtherCon []]
 a_rHJ =
   \ (s_sJW [Occ=Once] :: GHC.Prim.State# GHC.Prim.RealWorld) ->
     case s_sJW of s'_sJX [InlPrag=NOINLINE] { __DEFAULT ->
     (# s'_sJX, GHC.Tuple.() #)
     }

 Crash.crash :: GHC.Types.IO ()
 [GblId, Arity=1, Caf=NoCafRefs, Str=DmdType, Unf=OtherCon []]
 Crash.crash =
   (\ (eta_B1 [Occ=Once, OS=OneShot]
         :: GHC.Prim.State# GHC.Prim.RealWorld) ->
      a_rHJ eta_B1)
   `cast` (Sym (GHC.Types.NTCo:IO[0] <()>_R)
           :: (GHC.Prim.State# GHC.Prim.RealWorld
               -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
                ~#
              GHC.Types.IO ())



 *** Stg2Stg:
 *** CodeOutput:
 *** New CodeGen:
 *** CPSZ:
 *** CPSZ:
 *** Deleting temp files:
 Warning: deleting non-existent /tmp/ghc3661_0/ghc3661_3.c
 Warning: deleting non-existent /tmp/ghc3661_0/ghc3661_1.s
 *** Deleting temp dirs:
 ghc: panic! (the 'impossible' happened)
   (GHC version 7.8.3 for x86_64-unknown-linux):
         StgCmmEnv: variable not found
     s{v sJW} [lid]
     local binds for:

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
 }}}

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


More information about the ghc-tickets mailing list