When building gdb with -Werror, the compile fails due to what looks like a spurious warning from using -Wuninitialized. I've reduced the testcase down to a minimal one, hopefully preserving the original cause of the warning.
Environment: System: Linux puffer.diveadx.com 2.6.16-1.2069_FC4smp #1 SMP Tue Mar 28 12:47:32 EST 2006 i686 i686 i386 GNU/Linux Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: /src/latest/trunk/src/gcc/configure -v --prefix=/opt/local/latest/trunk --enable-languages=c,c++ --cache-file=.././config.cache --srcdir=/src/latest/trunk/src/gcc How-To-Repeat: /* Run as: $ gcc -c -O2 -Wuninitialized bug.c bug.c: In function âfooâ: bug.c:19: warning: âtmp_obstack.chunk_sizeâ may be used uninitialized in this function */ struct obstack { long chunk_size; }; static struct obstack dont_print_statmem_obstack; void foo (int dont_print_statmem, int start) { int i; struct obstack tmp_obstack; if (dont_print_statmem == 0) { tmp_obstack = dont_print_statmem_obstack; } for (i = start; i < 7; i++) { } if (dont_print_statmem == 0) { dont_print_statmem_obstack = tmp_obstack; } } -- Summary: Gcc produces spurious -Wuninitialized warning compiling gdb Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fnf at specifix dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27289