summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authornineonine <mail4chemik@gmail.com>2022-01-17 23:00:21 -0800
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-04 20:35:45 -0500
commit88480e55f14c155516c96e716793c76f305d9303 (patch)
treebcac7bde06e63a933527db5dc4e548392867b9db /rts
parent8c18feba88aaa20b75b82c3fee7e8f742299461e (diff)
downloadhaskell-88480e55f14c155516c96e716793c76f305d9303.tar.gz
Fix unsound behavior of unlifted datatypes in ghci (#20194)
Previously, directly calling a function that pattern matches on an unlifted data type which has at least two constructors in GHCi resulted in a segfault. This happened due to unaccounted return frame info table pointer. The fix is to pop the above mentioned frame info table pointer when unlifted things are returned. See Note [Popping return frame for unlifted things] authors: bgamari, nineonine
Diffstat (limited to 'rts')
-rw-r--r--rts/Interpreter.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rts/Interpreter.c b/rts/Interpreter.c
index c911d99367..8c2195b6e9 100644
--- a/rts/Interpreter.c
+++ b/rts/Interpreter.c
@@ -1702,7 +1702,7 @@ run_BCO:
case bci_TESTLT_P: {
unsigned int discr = BCO_NEXT;
int failto = BCO_GET_LARGE_ARG;
- StgClosure* con = (StgClosure*)SpW(0);
+ StgClosure* con = UNTAG_CLOSURE((StgClosure*)SpW(0));
if (GET_TAG(con) >= discr) {
bciPtr = failto;
}
@@ -1712,7 +1712,7 @@ run_BCO:
case bci_TESTEQ_P: {
unsigned int discr = BCO_NEXT;
int failto = BCO_GET_LARGE_ARG;
- StgClosure* con = (StgClosure*)SpW(0);
+ StgClosure* con = UNTAG_CLOSURE((StgClosure*)SpW(0));
if (GET_TAG(con) != discr) {
bciPtr = failto;
}