Article View: gnu.gdb.bug
Article #132Anonymous struct printing bug in either gdb or g++
From: Joe Shapiro
Date: Mon, 27 Jul 1992 22:17
Date: Mon, 27 Jul 1992 22:17
55 lines
2142 bytes
2142 bytes
Hi, Folks
I'm not sure whether this is a g++ or gdb bug, so I'm sending this report
to both bug mailing lists. gdb 4.6 (and 4.5) can't find the type of a g++
anonymous (i.e. untagged) struct. Here's an example:
struct
{
int a, b;
} anon;
struct named_t
{
int a, b;
} named;
main()
{
++anon.a;
++named.a;
}
joe@somalia> g++ -g -v static-bug.cc
Reading specs from /usr/local/lib/gcc-lib/sun4/2.2.2/specs
gcc version 2.2.2
/usr/local/lib/gcc-lib/sun4/2.2.2/cpp -lang-c++ -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -g static-bug.cc /usr/tmp/cca00705.i
/usr/local/lib/gcc-lib/sun4/2.2.2/cc1plus /usr/tmp/cca00705.i -quiet -dumpbase static-bug.cc -g -o /usr/tmp/cca00705.s
as -o static-bug.o /usr/tmp/cca00705.s
/usr/local/lib/gcc-lib/sun4/2.2.2/ld -e start -dc -dp /lib/crt0.o -L/usr/local/lib/gcc-lib/sun4/2.2.2 -L/usr/local/lib static-bug.o -lg++ -lgcc -lc -lg -lgcc
/home/joe/gnu-bugs /home/joe/c-saw
joe@somalia> gdb a.out
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
(gdb) b main
Breakpoint 1 at 0x229c: file static-bug.cc, line 15.
(gdb) r
Starting program: /usr3/joe/gnu-bugs/a.out
Breakpoint 1, main () at static-bug.cc:15
15 ++anon.a;
(gdb) p anon
$1 = <unknown struct>
(gdb) p named
$2 = {a = 0, b = 0}
(gdb) q
The program is running. Quit anyway? (y or n) y
Technical Details
Message-ID:
<9207272217.AA00764@somalia.consolve>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!bu.edu!ai-lab!ai.mit.edu!gnulistsShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!bu.edu!ai-lab!ai.mit.edu!gnulists From: joe@consolve.com (Joe Shapiro) Newsgroups: gnu.gdb.bug,gnu.g++.bug Subject: Anonymous struct printing bug in either gdb or g++ Message-ID: <9207272217.AA00764@somalia.consolve> Date: 27 Jul 92 22:17:14 GMT Followup-To: poster Lines: 55 Approved: info-gnu@prep.ai.mit.edu To: bug-g++@prep.ai.mit.edu, bug-gdb@prep.ai.mit.edu