Fix crash in non-threaded RTS on Windows
[ghc-hetmet.git] / rts / win32 / AsyncIO.c
index 8662e2a..5dedee0 100644 (file)
@@ -313,6 +313,11 @@ start:
                        /* Terminates the run queue + this inner for-loop. */
                        tso->_link = END_TSO_QUEUE;
                        tso->why_blocked = NotBlocked;
+                        // save the StgAsyncIOResult in the
+                        // stg_block_async_info stack frame, because
+                        // the block_info field will be overwritten by
+                        // pushOnRunQueue().
+                        tso->sp[1] = (W_)tso->block_info.async_result;
                        pushOnRunQueue(&MainCapability, tso);
                        break;
                    }