public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Initialize previous in read_state_param_structs
@ 2011-05-30 10:56 Alexandre Oliva
  2011-05-30 11:50 ` Bernd Schmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Oliva @ 2011-05-30 10:56 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

Bootstrap-O3 complains about uninitialized uses of this variable in
gengtype-state.c.  The variable can never actually be used before
initialization, but GCC is not smart enough to realize that.
read_state_structures, just before the function at hand, has a similar
loop and it zero-initializes both head and previous, so I adjusted the
affected function to follow the same pattern and avoid the bogus
warning.  Regstrapped on x86_64-linux-gnu and i686-pc-linux-gnu.  Ok to
install?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: O3-gengtype-state.patch --]
[-- Type: text/x-diff, Size: 669 bytes --]

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

	* gengtype-state.c (read_state_params_structs): Initialize
	previous.

Index: gcc/gengtype-state.c
===================================================================
--- gcc/gengtype-state.c.orig	2011-05-18 05:02:28.341594395 -0300
+++ gcc/gengtype-state.c	2011-05-18 05:02:32.710587356 -0300
@@ -2137,7 +2137,7 @@ read_state_param_structs (type_p *param_
   int nbparamstructs = 0;
   int countparamstructs = 0;
   type_p head = NULL;
-  type_p previous;
+  type_p previous = NULL;
   type_p tmp;
   struct state_token_st *t0 = peek_state_token (0);
   struct state_token_st *t1 = peek_state_token (1);

[-- Attachment #3: Type: text/plain, Size: 257 bytes --]


-- 
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-04 10:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-30 10:56 Initialize previous in read_state_param_structs Alexandre Oliva
2011-05-30 11:50 ` Bernd Schmidt
2011-06-04  3:16   ` Jack Howarth
2011-06-04 10:21     ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).