View Bug Activity | Format For Printing
[Converted from Gnats 2418] funaddr in the function of find_function_addr may be initialized to satisfy the compiler. Below is the error message: gcc -c -g -O2 -I. -I../../gdb/gdb -I../../gdb/gdb/config -DLOCALEDIR="\"/home/ gdb/gdb/../include/opcode -I../../gdb/gdb/../readline/.. -I../bfd -I../../gdb/gd ./gdb/gdb/../libdecnumber -DMI_OUT=1 -DTUI=1 -Wall -Wdeclaration-after-statem tch -Wno-char-subscripts -Werror ../../gdb/gdb/infcall.c cc1: warnings being treated as errors ../../gdb/gdb/infcall.c: In function `find_function_addr': ../../gdb/gdb/infcall.c:197: warning: initialization makes integer from pointer make[2]: *** [infcall.o] Error 1 make[2]: Leaving directory `/home/robert_bu/src/temp/build_gdb/gdb' make[1]: *** [all-gdb] Error 2 make[1]: Leaving directory `/home/robert_bu/src/temp/build_gdb' make: *** [all] Error 2 Release: snapshot of 20080226, or most updated CVS Environment: Linux, GCC-3.2.3 How-To-Repeat: Just build the package
I don't see this happening in current mainline. In general, there's no need to report these build errors through the bug tracker. The GDB developers build gdb regularly, so these kinds of problem are always quickly fixed. Thanks!
Subject: Re: build error from compiler warning for -Werror Sorry for the in-convenience. I still can re-produce the bug from CVS-20090120. gcc -g -O2 -I. -I../../src/gdb -I../../src/gdb/config -DLOCALEDIR="\"/home/robert_bu/local/gdb-cvs/share/locale\"" -DHAVE_CONFIG_H -I../../src/gdb/../include/opcode -I../../src/gdb/../readline/.. -I../bfd -I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber -I../../src/gdb/../libdecnumber -I../../src/gdb/gnulib -Ignulib -DMI_OUT=1 -DTUI=1 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-unused -Wno-switch -Wno-char-subscripts -Werror -c -o infcall.o -MT infcall.o -MMD -MP -MF .deps/infcall.Tpo ../../src/gdb/infcall.c cc1: warnings being treated as errors ../../src/gdb/infcall.c: In function `find_function_addr': ../../src/gdb/infcall.c:212: warning: `funaddr' might be used uninitialized in this function make[2]: *** [infcall.o] Error 1 make[2]: Leaving directory `/home/robert_bu/src/gdb_cvs/build/gdb' make[1]: *** [all-gdb] Error 2 make[1]: Leaving directory `/home/robert_bu/src/gdb_cvs/build' make: *** [all] Error 2 My host is a Redhat Enterprise 3. The GCC is: Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-54) I have to initialize funaddr to NULL to compile CVS gdb. -----Original Message----- From: pedro at codesourcery dot com Sent: 2009-01-18 9:50 > ------- Additional Comments From pedro at codesourcery dot com 2009-01-18 01:50 ------- > I don't see this happening in current mainline. > > In general, there's no need to report these build errors through the bug > tracker. The GDB developers build gdb regularly, so these kinds of problem are > always quickly fixed. > > Thanks! > >
Ok, thanks. That's a different warning though: old: >../../gdb/gdb/infcall.c: In function `find_function_addr': >../../gdb/gdb/infcall.c:197: warning: initialization makes integer from pointer >make[2]: *** [infcall.o] Error 1 new: ../../src/gdb/infcall.c: In function `find_function_addr': ../../src/gdb/infcall.c:212: warning: `funaddr' might be used uninitialized in this function I can't see any path where funaddr might be used uninitialized, though. Maybe a gcc-3.2.3 bug? I happen to have gcc 3.3 and 3.4 on my box, and those also don't trigger this. Initializing to NULL may silently hide some future bugs, where that warning would be useful. Oh, well, we should handle this somehow.
Subject: Re: build error in incall.c on gcc 3.2.3, due to compiler warning with -Werror Yes. It can be a gcc-3.2.3 -O2 bug. Without -O2, it compiles without any problem. I tried gcc-3.3.6 here, and didn't encounter the problem. Thank you for your kind patience. -----Original Message----- From: pedro at codesourcery dot com Sent: 2009-01-21 21:39 > ------- Additional Comments From pedro at codesourcery dot com 2009-01-21 13:38 ------- > Ok, thanks. That's a different warning though: > > old: >> ../../gdb/gdb/infcall.c: In function `find_function_addr': >> ../../gdb/gdb/infcall.c:197: warning: initialization makes integer from pointer >> make[2]: *** [infcall.o] Error 1 > > new: > ./../src/gdb/infcall.c: In function `find_function_addr': > ./../src/gdb/infcall.c:212: warning: `funaddr' might be used > uninitialized in this function > > I can't see any path where funaddr might be used uninitialized, though. > Maybe a gcc-3.2.3 bug? I happen to have gcc 3.3 and 3.4 on my box, and > those also don't trigger this. > > Initializing to NULL may silently hide some future bugs, where that > warning would be useful. Oh, well, we should handle this somehow. > >
*** Bug 10024 has been marked as a duplicate of this bug. ***
One idea would be to disable the warnings for older versions of GCC.
Actually, GDB releases used to ship with --disable-werror by default, which I think is a good idea. GDB 6.8 uses -Werror by default, but I think that was an oversight. For snapshots of CVS HEAD, one should configure with --disable-werror if problems like this are encountered. Perhaps we should document this more prominently?
By the way, I'm not opposed to creating a list of known-bad GCC versions and selectively disable -Werror for them in CVS HEAD...