david@TERA.COM (David Callahan) (11/27/89)
config.g++ sun3-nfp-os4 g++ emits incomplete symbol table information for structures with anonymous unions. Example: ----------file: gnu-bug2.c ---------- #include <stream.h> struct temp { int i1 ; union { int a; float b ;} ; int i2 ; } ; main() { temp t ; t.a = 4 ; cout << t.a << "\n" ; t.b = 2.2 ; cout << t.b << "\n" ; } ----------sample compilation-------- g++ -v -o bug -g gnu-bug2.c gcc version 1.36.1 (based on GCC 1.36) /usr/local/lib/g++-1.36.1/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -Dmc68020 gnu-bug2.c /usr/tmp/cca02441.cpp GNU CPP version 1.36 /usr/local/lib/g++-1.36.1/gcc-cc1plus /usr/tmp/cca02441.cpp -quiet -dumpbase gnu-bug2.c -g -version -o /usr/tmp/cca02441.s GNU C++ version 1.36.1 (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36. default target switches: -m68020 -mc68020 -mbitfield /usr/local/lib/g++-1.36.1/gcc-as -mc68020 -o gnu-bug2.o /usr/tmp/cca02441.s /usr/local/lib/g++-1.36.1/gcc-ld -o bug -e start -dc -dp -Bstatic /lib/crt0.o /lib/Fcrt1.o gnu-bug2.o -lg++ /usr/local/lib/g++-1.36.1/gcc-gnulib -lg -lc ---------- Sample (correct) exection ------------ dactyl% bug 4 2.2 dactyl% ---------- Partial debugging information: ------------ dactyl% nm -a bug | grep temp 00000000 - 00 0000 LSYM temp:T211 00000000 - 00 0000 LSYM temp:t211 00000000 - 00 0000 LSYM temp:t211=s12i1:/21,0,32;i2:/21,64,32;;~; dactyl% -------------- Sample debugging session ------------ dactyl% gdb bug gdb bug GDB 3.4, Copyright (C) 1989 Free Software Foundation, Inc. There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details. GDB is free software and you are welcome to distribute copies of it under certain conditions; type "info copying" to see the conditions. Reading symbol data from /home/tera/david/Cfront/bug...done. Type "help" for a list of commands. (gdb) break main Reading in symbols for gnu-bug2.c...done. Breakpoint 1 at 0x22be: file gnu-bug2.c, line 8. (gdb) run Starting program: /home/tera/david/Cfront/bug Bpt 1, main () (gnu-bug2.c line 10) 10 t.a = 4 ; (gdb) whatis t type = temp (gdb) p t $1 = {i1 = 0, i2 = 0} (gdb) p t.a there is no field named a (gdb) quit The program is running. Quit anyway? (y or n) y dactyl% ---------- David Callahan david@tera.com Tera Computer Co. 400 North 34th Street, Suite 300 Seattle WA, 98103