[commit: ghc] ghc-8.0: rts/LdvProfile.c: Fix NULL dereference on shutdown (57e7078)

git at git.haskell.org git at git.haskell.org
Fri Aug 26 14:02:05 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/57e707821be933c673927426b001b1cdd83de3ac/ghc

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

commit 57e707821be933c673927426b001b1cdd83de3ac
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date:   Fri Apr 29 07:15:53 2016 +1000

    rts/LdvProfile.c: Fix NULL dereference on shutdown
    
    Test Plan: validate
    
    Reviewers: carter, austin, simonmar, bgamari
    
    Reviewed By: simonmar, bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2154
    
    GHC Trac Issues: #11978
    
    (cherry picked from commit bcfee2181e7b7edfea3473ec408a3a2a1815ecff)


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

57e707821be933c673927426b001b1cdd83de3ac
 rts/LdvProfile.c                                                       | 3 +++
 testsuite/tests/profiling/should_run/T11978a.hs                        | 2 ++
 .../should_run/T5594.stdout => profiling/should_run/T11978a.stdout}    | 0
 3 files changed, 5 insertions(+)

diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c
index 29fb24d..51cd3d7 100644
--- a/rts/LdvProfile.c
+++ b/rts/LdvProfile.c
@@ -179,6 +179,9 @@ processNurseryForDead( void )
     StgPtr p;
     bdescr *bd;
 
+    if (MainCapability.r.rNursery == NULL)
+        return;
+
     for (bd = MainCapability.r.rNursery->blocks; bd != NULL; bd = bd->link) {
         p = bd->start;
         while (p < bd->free) {
diff --git a/testsuite/tests/profiling/should_run/T11978a.hs b/testsuite/tests/profiling/should_run/T11978a.hs
new file mode 100644
index 0000000..bb859f3
--- /dev/null
+++ b/testsuite/tests/profiling/should_run/T11978a.hs
@@ -0,0 +1,2 @@
+main :: IO ()
+main = putStrLn "Hello!"
diff --git a/testsuite/tests/ffi/should_run/T5594.stdout b/testsuite/tests/profiling/should_run/T11978a.stdout
similarity index 100%
copy from testsuite/tests/ffi/should_run/T5594.stdout
copy to testsuite/tests/profiling/should_run/T11978a.stdout



More information about the ghc-commits mailing list