[commit: ghc] master: Fix calculation in threadStackOverflow (8adb84f)

git at git.haskell.org git at git.haskell.org
Mon Oct 16 08:24:04 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8adb84fe190260cdd4bc12a40962e894f1f9ed18/ghc

>---------------------------------------------------------------

commit 8adb84fe190260cdd4bc12a40962e894f1f9ed18
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Sat Sep 30 13:11:07 2017 -0500

    Fix calculation in threadStackOverflow
    
    Summary:
    The calculation was too conservative, and could result in copying zero
    frames into the new stack chunk, which caused a knock-on failure in
    the interpreter.
    
    Test Plan: Tested on an in-house repro (not shareable, unfortunately)
    
    Reviewers: niteria, bgamari, austin, erikd
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D4052


>---------------------------------------------------------------

8adb84fe190260cdd4bc12a40962e894f1f9ed18
 rts/Threads.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rts/Threads.c b/rts/Threads.c
index 836cdd6..79c86f7 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -640,8 +640,8 @@ threadStackOverflow (Capability *cap, StgTSO *tso)
             // if including this frame would exceed the size of the
             // new stack (taking into account the underflow frame),
             // then stop at the previous frame.
-            if (sp + size > old_stack->stack + (new_stack->stack_size -
-                                                sizeofW(StgUnderflowFrame))) {
+            if (sp + size > old_stack->sp + (new_stack->stack_size -
+                                             sizeofW(StgUnderflowFrame))) {
                 break;
             }
             sp += size;



More information about the ghc-commits mailing list