Assertion failure with unsaturated primop
The test T17817b.hs
, which just defines f = mkWeak#
, throws an assertion failure when compiled with ghci
or with -fhpc
.
WARNING:
[, , ,] forall {l :: Levity} (a :: TYPE ('BoxedRep l)) b c.
a
-> b
-> (State# RealWorld -> (# State# RealWorld, c #))
-> State# RealWorld
-> (# State# RealWorld, Weak# b #)
mkWeak#
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Driver/Ppr.hs:126:29 in ghc:GHC.Driver.Ppr
warnPprTrace, called at compiler/GHC/Core/Opt/Arity.hs:1555:10 in ghc:GHC.Core.Opt.Arity
ghc-stage2: panic! (the 'impossible' happened)
GHC version 9.1.20210609:
ASSERT failed!
CallStack (from HasCallStack):
assert, called at compiler/GHC/CoreToStg.hs:548:37 in ghc:GHC.CoreToStg
The assertion checks if the primop is saturated. As far as I can tell, this should happen in CorePrep but the ticks added by ghci or hpc interfere.
#17846 is related, but touches a different path, does not happen with ghci and seems fixed in 9.0 (probably by eta-expansion of tuples).