[commit: ghc] master: rts: Fix uninitialised variable uses (8f8d756)

git at git.haskell.org git at git.haskell.org
Mon Jul 3 23:42:51 UTC 2017


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

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

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

commit 8f8d756c5a29217ff79154caa1696b6e572d186f
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


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

8f8d756c5a29217ff79154caa1696b6e572d186f
 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 a2f0b58..a22e966 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 691e56a..9a077b3d14 100644
--- a/rts/sm/MarkWeak.c
+++ b/rts/sm/MarkWeak.c
@@ -364,7 +364,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