Skip to content

Test of atomic fetches fails on i386 with allocateRegsAndSpill panic

An i386 job for !10228 (closed) (https://gitlab.haskell.org/ghc/ghc/-/jobs/1435453#L4752) fails with:

Compile failed (exit code 1) errors were:
ghc-9.7.20230402: panic! (the 'impossible' happened)
  GHC version 9.7.20230402:
	allocateRegsAndSpill: Cannot read from uninitialized register
  %vHi_H3
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:189:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/CmmToAsm/Reg/Linear.hs:837:20 in ghc:GHC.CmmToAsm.Reg.Linear
  CallStack (from HasCallStack):
    panic, called at compiler/GHC/Utils/Error.hs:480:29 in ghc:GHC.Utils.Error

GHC.CmmToAsm.Reg.Linear says

                   pprPanic "allocateRegsAndSpill: Cannot read from uninitialized register" (ppr r)
                   -- NOTE: if the input to the NCG contains some
                   -- unreachable blocks with junk code, this panic
                   -- might be triggered.  Make sure you only feed
                   -- sensible code into the NCG.  In GHC.Cmm.Pipeline we
                   -- call removeUnreachableBlocks at the end for this
                   -- reason.

This might be very well the case: !10228 (closed) adds a test case with hand-written CMM. However, while the code in question is silly, up to my (very limited) understanding all blocks should be reachable. And all 64-bit jobs succeed.

This is not a blocker for !10228 (closed) (#23206 (closed)) which is concerned only with adding %fetch_fooXX primops to CMM parser. I'm going to disable i386 job there.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information