This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [vta, trunk?] avoid uninitialized variable warnings building with -O3


On Dec 28, 2008, Ian Lance Taylor <iant@google.com> wrote:

> Alexandre Oliva <aoliva@redhat.com> writes:
>> Installing in the branch.  Ok for trunk?
>> 
>> for  gcc/ChangeLog.vta
>>> From  Alexandre Oliva  <aoliva@redhat.com>
>> 
>> * c-parser.c (c_parser_binary_expression): Initialize binary_loc.
>> * ebitmap.h (ebitmap_iter_init): Initialize all fields.
>> * ipa-struct-reorg.c (gen_struct_type): Replace known-true
>> test with assertion.

> This is OK for mainline.

Thanks, I'm finally checking this in (thanks, David, for the reminder).

I dropped the c-parser.c bit, that had already been fixed.  This is what
I've just installed.

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* ebitmap.h (ebitmap_iter_init): Initialize all fields.
	* ipa-struct-reorg.c (gen_struct_type): Replace known-true
	test with assertion.

Index: gcc/ebitmap.h
===================================================================
--- gcc/ebitmap.h	(revision 143442)
+++ gcc/ebitmap.h	(working copy)
@@ -1,5 +1,5 @@
 /* Sparse array based bitmaps.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -95,7 +95,13 @@
 		     min / EBITMAP_ELT_BITS);
   i->size = bmp->numwords;
   if (i->size == 0)
-    return;
+    {
+      i->ptr = NULL;
+      i->eltnum = 0;
+      i->bit_num = 0;
+      i->word = 0;
+      return;
+    }
   i->ptr = bmp->elts;
   i->bit_num = min;
   i->eltnum = 0;
Index: gcc/ipa-struct-reorg.c
===================================================================
--- gcc/ipa-struct-reorg.c	(revision 143442)
+++ gcc/ipa-struct-reorg.c	(working copy)
@@ -1865,8 +1865,9 @@
 	  wr.wrap = 0;
 	  wr.domain = NULL_TREE;
 	}
-      else if (TREE_CODE (type_orig) == ARRAY_TYPE)
+      else
 	{
+	  gcc_assert (TREE_CODE (type_orig) == ARRAY_TYPE);
 	  wr.wrap = 1;
 	  wr.domain = TYPE_DOMAIN (type_orig);
 	}

-- 
Alexandre Oliva           http://www.lsd.ic.unicamp.br/~oliva/
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]