Patchwork Fix uninitialized error with BUILD_CONFIG=bootstrap-O1

login
register
mail settings
Submitter Alexandre Oliva
Date June 11, 2010, 7:40 p.m.
Message ID <or631pmk71.fsf@livre.localdomain>
Download mbox | patch
Permalink /patch/55353/
State New
Headers show

Comments

Alexandre Oliva - June 11, 2010, 7:40 p.m.
On Jun 11, 2010, Eric Botcazou <ebotcazou@adacore.com> wrote:

>> I suppose -O2 infers that new_ptr can't be NULL because it's
>> dereferenced before, so last will always be set before we exit the loop,
>> but at -O1 it doesn't.
>> 
>> This patch avoids the warning, but perhaps the loop should be turned
>> into a do/while loop to avoid the unnecessary test.

> The most correct version is 'last = NULL_TREE' but then the line overflows.
> So I'd initialize 'last' to NULL_TREE in its declaration; OK with this change.

Thanks, I'm checking this in.

Patch

for  gcc/ada/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* gcc-interface/utils.c (update_pointer_to): Initialize last.

Index: gcc/ada/gcc-interface/utils.c
===================================================================
--- gcc/ada/gcc-interface/utils.c.orig	2010-06-11 10:56:19.000000000 -0300
+++ gcc/ada/gcc-interface/utils.c	2010-06-11 16:26:06.000000000 -0300
@@ -3461,7 +3461,7 @@  update_pointer_to (tree old_type, tree n
     {
       tree new_ptr = TYPE_MAIN_VARIANT (TYPE_POINTER_TO (new_type));
       tree new_obj_rec = TYPE_OBJECT_RECORD_TYPE (new_type);
-      tree array_field, bounds_field, new_ref, last;
+      tree array_field, bounds_field, new_ref, last = NULL_TREE;
 
       gcc_assert (TYPE_IS_FAT_POINTER_P (ptr));