[commit: ghc] ghc-8.2: rts: Fix uninitialised variable uses (6a51690)

git at git.haskell.org git at git.haskell.org
Tue Jul 4 00:16:46 UTC 2017


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

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/6a516900ae29729f258ae8c2f4768e2d27e5facf/ghc

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

commit 6a516900ae29729f258ae8c2f4768e2d27e5facf
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Jul 3 19:07:59 2017 -0400

    rts: Fix uninitialised variable uses
    
    Strangely gcc 5.4 compiling on amd64 (nixos) complained about these.
    Both warnings look correct, so I'm not sure why we haven't been seeing
    these up until now.
    
    Test Plan: Validate
    
    Reviewers: simonmar, austin, erikd
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3693
    
    (cherry picked from commit 8f8d756c5a29217ff79154caa1696b6e572d186f)


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

6a516900ae29729f258ae8c2f4768e2d27e5facf
 rts/Interpreter.c | 2 +-
 rts/sm/MarkWeak.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/rts/Interpreter.c b/rts/Interpreter.c
index b60139e..02bf123 100644
--- a/rts/Interpreter.c
+++ b/rts/Interpreter.c
@@ -285,7 +285,7 @@ interpretBCO (Capability* cap)
     // that these entities are non-aliasable.
     register StgPtr       Sp;    // local state -- stack pointer
     register StgPtr       SpLim; // local state -- stack lim pointer
-    register StgClosure   *tagged_obj = 0, *obj;
+    register StgClosure   *tagged_obj = 0, *obj = NULL;
     uint32_t n, m;
 
     LOAD_THREAD_STATE();
diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c
index e7dfd6e..89fc551 100644
--- a/rts/sm/MarkWeak.c
+++ b/rts/sm/MarkWeak.c
@@ -363,7 +363,7 @@ static void tidyThreadList (generation *gen)
 static void checkWeakPtrSanity(StgWeak *hd, StgWeak *tl)
 {
     StgWeak *w, *prev;
-    for (w = hd; w != NULL; prev = w, w = w->link) {
+    for (prev = NULL, w = hd; w != NULL; prev = w, w = w->link) {
         ASSERT(INFO_PTR_TO_STRUCT(UNTAG_CLOSURE((StgClosure*)w)->header.info)->type == WEAK
             || UNTAG_CLOSURE((StgClosure*)w)->header.info == &stg_DEAD_WEAK_info);
         checkClosure((StgClosure*)w);



More information about the ghc-commits mailing list