Here is the simple C++ program : int main() { union { int z; unsigned int w; }; w = 0; }
Confirmed.
Subject: Re: GCC does not emit debug info for variables in anonymous unions It is because of ALIAS_DECL
This is a regression from 3.3.3.
(In reply to comment #2) > It is because of ALIAS_DECL Which means it was caused by: 2002-12-18 Jason Merrill <jason@redhat.com> Handle anonymous unions at the tree level. C++ ABI change: Mangle anonymous unions using the name of their first named field (by depth-first search). Should not cause binary compatibility problems, though, as the compiler previously didn't emit anything for affected unions. * cp-tree.def (ALIAS_DECL): New tree code.
Moving to 4.0.2 pre Mark.
Created attachment 9699 [details] proposed patch This patch bears up against minmal testing on linux. Please test on Darwin, or other system that defaults to stabs.
Subject: Re: [3.4/4.0/4.1 Regression] GCC does not emit debug info for variables in anonymous unions It does not fix gdb.cp/anon-union.exp (from GDB testsuite) failures using darwin GDB. If you do not get any other feedback/info then I'll try to get back to this next week. - Devang
Well it does with cvs head gdb on linux, both stabs and dwarf2. If you'll verify that you see something akin to .stabs "z:(0,7)",128,0,0,-4 .stabs "w:(0,9)",128,0,0,-4 in your assembly file, I'll close this as fixed on the gcc side.
I get: .stabs "z:(0,9)",128,0,6,24 .stabs "w:(0,11)",128,0,6,24
(In reply to comment #9) > I get: > .stabs "z:(0,9)",128,0,6,24 > .stabs "w:(0,11)",128,0,6,24 After updating my gcc to the today's mainline instead of one from yesterday, darwin's gdb works correctly for me.
Subject: Bug 20998 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: rth@gcc.gnu.org 2005-09-09 21:05:57 Modified files: gcc : ChangeLog Makefile.in dbxout.c gcc/cp : ChangeLog cp-tree.def decl2.c error.c name-lookup.c semantics.c Log message: PR debug/20998 * dbxout.c: Include expr.h. (dbxout_global_decl): Don't suppress for DECL_RTL unset. (dbxout_symbol): Handle DECL_VALUE_EXPR. * Makefile.in (dbxout.o): Add EXPR_H. cp/ * cp-tree.def (ALIAS_DECL): Remove. * cp-lang.c (cp_init_ts): Remove support for it. * error.c (dump_decl): Likewise. * name-lookup.c (pushdecl): Likewise. * semantics.c (finish_id_expression): Likewise. * decl2.c (build_anon_union_vars): Use a VAR_DECL with DECL_VALUE_EXPR instead. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.422&r2=2.7592.2.423 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/Makefile.in.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1447.2.4&r2=1.1447.2.5 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dbxout.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.221.2.2&r2=1.221.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.97&r2=1.4648.2.98 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.def.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.94.4.3&r2=1.94.4.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.770.2.7&r2=1.770.2.8 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.279.2.2&r2=1.279.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.109.4.8&r2=1.109.4.9 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.463.2.9&r2=1.463.2.10
Fixed.
Oh, and that's a WONTFIX for 3.4, in case anyone's interested.