initialize incr in c-parser.c:c_parser_for_statement

Submitted by Alexandre Oliva on Oct. 13, 2010, 5:20 a.m.

Details

Message ID or1v7uu0sb.fsf@livre.localdomain
State New
Headers show

Commit Message

Alexandre Oliva Oct. 13, 2010, 5:20 a.m.
Bootstrap fails with bootstrap-O3 because GCC gets the impression that
incr is used without being initialized.  AFAICT the impression is wrong,
and incr is initialized in every path that leads to the use, but it's
not too much of a problem to initialize it with the value that is stored
in it in most other paths anyway.

I'm checking this in as obviously correct.  Regstrapped on
x86_64-linux-gnu and i686-pc-linux-gnu.

Patch hide | download patch | download mbox

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

	* c-parser.c (c_parser_for_statement): Initialize incr.

Index: gcc/c-parser.c
===================================================================
--- gcc/c-parser.c.orig	2010-10-08 20:24:43.873491162 -0300
+++ gcc/c-parser.c	2010-10-08 20:29:04.034490577 -0300
@@ -4538,6 +4538,9 @@  c_parser_for_statement (c_parser *parser
       /* Parse the initialization declaration or expression.  */
       cond = error_mark_node;
       object_expression = error_mark_node;
+      /* Initializing incr should not be necessary, but it avoids
+	 bogus warnings of uninitialized uses.  */
+      incr = error_mark_node;
 
       if (c_parser_next_token_is (parser, CPP_SEMICOLON))
 	{