This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/27289] New: Gcc produces spurious -Wuninitialized warning compiling gdb
- From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Apr 2006 16:52:02 -0000
- Subject: [Bug c/27289] New: Gcc produces spurious -Wuninitialized warning compiling gdb
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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