struct a { union { int i; }; } a; int main (void) { return sizeof (a.i); } ------------------------------------------------------------------------------- C code returns 4. GDB: (gdb) p sizeof (a.i) Type struct a has no component named i. Although: (gdb) p a.i $1 = 0
Subject: Bug 11530 CVSROOT: /cvs/src Module name: src Changes by: muller@sourceware.org 2010-05-11 22:03:04 Modified files: gdb : gdbtypes.c ChangeLog gdb/testsuite : ChangeLog Added files: gdb/testsuite/gdb.base: gdb11530.c gdb11530.exp Log message: 2010-05-11 Pierre Muller <muller@ics.u-strasbg.fr> PR exp/11530. * gdbtypes.c (lookup_struct_elt_type): Also lookup names of unnamed structures or unions. testsuite ChangeLog entry: 2010-05-11 Pierre Muller <muller@ics.u-strasbg.fr> PR exp/11530. * testsuite/gdb.base/gdb11530.c: New file. * testsuite/gdb.base/gdb11530.exp: New file. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbtypes.c.diff?cvsroot=src&r1=1.190&r2=1.191 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11778&r2=1.11779 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2264&r2=1.2265 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/gdb11530.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/gdb11530.exp.diff?cvsroot=src&r1=NONE&r2=1.1
I think this was fixed.