On Oct 30, 2012, Roland McGrath <rol...@hack.frob.com> wrote:

> The only initialization is conditional, but at least the first and last
> uses are unconditional.  (I don't understand the conditions of the second
> use enough to know whether it's always kosher.)

Lawrence let me know about that warning earlier today.  I don't get the
warning myself (my experiment to see what kind of warnings Googlers rely
on was a total success ;-), but I can explain why the code ended up this
way: before I made sure the condition protecting the assignment had to
be true, I had an else branch that initialized entry.  When I confirmed
the condition had to hold and the then branch was always taken, I
removed the else, but somehow I failed to turn the if into an assert.
Oops.  Sorry about that.

Here's a ready-to-install version of the patch I sent Lawrence earlier
today.  I'm nearly done testing the patch, and I'll check it as obvious
when it's done.


Avoid uninitialized warning when globalizing dead debug uses

From: Alexandre Oliva <aol...@redhat.com>

for  gcc/ChangeLog

	PR debug/54551
	PR debug/54693
	* valtrack.c (dead_debug_promote_uses): Assert-check that
	global used bit was clear and initialize entry
	unconditionally.
---

 gcc/valtrack.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/gcc/valtrack.c b/gcc/valtrack.c
index c1de41c..5eefabd 100644
--- a/gcc/valtrack.c
+++ b/gcc/valtrack.c
@@ -380,9 +380,11 @@ dead_debug_promote_uses (struct dead_debug_local *debug)
       if (!debug->global->used)
 	debug->global->used = BITMAP_ALLOC (NULL);
 
-      if (bitmap_set_bit (debug->global->used, REGNO (reg)))
-	entry = dead_debug_global_insert (debug->global, reg,
-					  make_debug_expr_from_rtl (reg));
+      bool added = bitmap_set_bit (debug->global->used, REGNO (reg));
+      gcc_checking_assert (added);
+
+      entry = dead_debug_global_insert (debug->global, reg,
+					make_debug_expr_from_rtl (reg));
 
       gcc_checking_assert (entry->dtemp);
 

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

Reply via email to