diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2022-03-28 15:59:04 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-04-22 08:00:18 -0400 |
commit | f435d55fe969e739eb92bbb681069020d0622137 (patch) | |
tree | 84816a862da56d35646f7f767195920a4f5cb9db /compiler/GHC/StgToByteCode.hs | |
parent | 76bb8cb3fd0f376b6af4bff12c29cb4226c24a72 (diff) | |
download | haskell-f435d55fe969e739eb92bbb681069020d0622137.tar.gz |
Fixes to rubbish literals
* In CoreToStg, the application 'RUBBISH[rep] x' was simplified
to 'RUBBISH[rep]'. But it is possible that the result of the function
is represented differently than the function.
* In Unarise, 'LitRubbish (primRepToType prep)'
is incorrect: LitRubbish takes a RuntimeRep such as IntRep,
while primRepToType returns a type such as Any @(TYPE IntRep). Use
primRepToRuntimeRep instead.
This code is never run in the testsuite.
* In StgToByteCode, all rubbish literals were assumed to be boxed.
This code predates representation-polymorphic RubbishLit and I think
it was not updated.
I don't have a testcase for any of those issues, but the code looks
wrong.
Diffstat (limited to 'compiler/GHC/StgToByteCode.hs')
-rw-r--r-- | compiler/GHC/StgToByteCode.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/GHC/StgToByteCode.hs b/compiler/GHC/StgToByteCode.hs index 0d6af799de..c3a1d6ff94 100644 --- a/compiler/GHC/StgToByteCode.hs +++ b/compiler/GHC/StgToByteCode.hs @@ -1722,7 +1722,9 @@ pushLiteral padded lit = LitChar {} -> code WordRep LitNullAddr -> code AddrRep LitString {} -> code AddrRep - LitRubbish {} -> code WordRep + LitRubbish rep -> case runtimeRepPrimRep (text "pushLiteral") rep of + [pr] -> code pr + _ -> pprPanic "pushLiteral" (ppr lit) LitNumber nt _ -> case nt of LitNumInt -> code IntRep LitNumWord -> code WordRep |