[commit: ghc] master: Do not segfault if no common root can be found (bcd3445)

git at git.haskell.org git at git.haskell.org
Sun Oct 9 22:55:12 UTC 2016


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

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

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

commit bcd34451382e0d1b52ef82cb9d762e9d68bc0887
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Sun Oct 9 18:17:46 2016 -0400

    Do not segfault if no common root can be found
    
    When trying to profile a plugin, ghc mysteriously segfaulted.  Upon
    closer examination the segfault happend due to a `->prevStack` lookup
    on a NULL pointer.
    
    A new CostCentre: Unknown is introduced that is set, if ccsapp and
    ccsfn are of equal depth (e.g. 0), and do not have a common CostCentre
    in their stacks.
    
    Reviewers: bgamari, simonmar, austin, erikd
    
    Reviewed By: simonmar
    
    Subscribers: Phyx, thomie
    
    Differential Revision: https://phabricator.haskell.org/D2551


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

bcd34451382e0d1b52ef82cb9d762e9d68bc0887
 rts/Linker.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/rts/Linker.c b/rts/Linker.c
index f16fb83..3eeb46e 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1399,6 +1399,11 @@ static SymbolAddr* lookupSymbol_ (SymbolName* lbl)
                 errorBelch("Could not on-demand load symbol '%s'\n", lbl);
                 return NULL;
             }
+#ifdef PROFILING
+            // collect any new cost centres & CCSs
+            // that were defined during runInit
+            initProfiling2();
+#endif
         }
 
         return val;



More information about the ghc-commits mailing list