From patchwork Fri Jun 11 19:40:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Fix uninitialized error with BUILD_CONFIG=bootstrap-O1 Date: Fri, 11 Jun 2010 09:40:50 -0000 From: Alexandre Oliva X-Patchwork-Id: 55353 Message-Id: To: Eric Botcazou Cc: gcc-patches@gcc.gnu.org On Jun 11, 2010, Eric Botcazou 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. for gcc/ada/ChangeLog from Alexandre Oliva * 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));