This is sources Bugzilla
Bugzilla Version 2.17.5
Bugzilla Bug 9523
  build error in infcall.c on gcc 3.2.3, due to compiler warning with -Werror Last modified: 2009-04-03 15:37:37
Bug List: First Last (This bug is not in your list)   Show list      Query page      Enter new bug
Bug#: 9523   Hardware:   Reporter: robert.bu@gmail.com
Host: Target: Build:
Product:     Add CC:
Component:   Version:   CC:
Remove selected CCs
Status: REOPENED   Priority:  
Resolution:   Severity:  
Assigned To: Not yet assigned to anyone <unassigned@sourceware.org>   Target Milestone:  
Summary:
Keywords:

Attachment Description Type Created Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 9523 depends on: Show dependency tree
Show dependency graph
Bug 9523 blocks:

Additional Comments:


Leave as REOPENED 
Mark bug as waiting for feedback
Mark bug as suspended
Accept bug (change status to ASSIGNED)
Resolve bug, changing resolution to
Resolve bug, mark it as duplicate of bug #
Reassign bug to
Reassign bug to owner of selected component

View Bug Activity   |   Format For Printing


Description:   Last confirmed: 0000-00-00 00:00 Opened: 2008-02-28 01:58
[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

------- Additional Comment #1 From Pedro Alves 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!

------- Additional Comment #2 From robert.bu@gmail.com 2009-01-20 06:28 -------
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!
>
>

------- Additional Comment #3 From Pedro Alves 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.

------- Additional Comment #4 From robert.bu@gmail.com 2009-01-22 01:26 -------
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.
>
>

------- Additional Comment #5 From Tom Tromey 2009-04-02 15:59 -------
*** Bug 10024 has been marked as a duplicate of this bug. ***

------- Additional Comment #6 From Tom Tromey 2009-04-02 16:01 -------
One idea would be to disable the warnings for older versions of GCC.

------- Additional Comment #7 From Thiago Jung Bauermann 2009-04-02 17:06 -------
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?

------- Additional Comment #8 From Thiago Jung Bauermann 2009-04-02 17:10 -------
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...

Bug List: First Last (This bug is not in your list)   Show list      Query page      Enter new bug
Actions: New | Query | bug # | Reports | Requests   New Account | Log In