summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index fa48bef1a7..9b1e98ea17 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -1315,7 +1315,9 @@ scheduleHandleThreadFinished (Capability *cap, Task *task, StgTSO *t)
if (t->what_next == ThreadComplete) {
if (task->incall->ret) {
// NOTE: return val is stack->sp[1] (see StgStartup.cmm)
- *(task->incall->ret) = (StgClosure *)task->incall->tso->stackobj->sp[1];
+ StgDeadThreadFrame *dead = (StgDeadThreadFrame *) &task->incall->tso->stackobj->sp[0];
+ ASSERT(dead->header.info == &stg_dead_thread_info);
+ *(task->incall->ret) = (StgClosure *) dead->result;
}
task->incall->rstat = Success;
} else {