The following valid code snippet triggers an ICE on mainline: ================================================================= typedef union { int i; } U __attribute__((transparent_union)); static void foo(U) {} static void foo(int) {} void bar() { foo(0); } ================================================================= bug.cc: In function 'void bar()': bug.cc:8: internal compiler error: same canonical type node for different types <anonymous union> and U Please submit a full bug report, [etc.]
Patch here: http://gcc.gnu.org/ml/gcc-patches/2008-02/msg01272.html
Subject: Bug 35315 Author: jason Date: Tue Feb 26 18:09:02 2008 New Revision: 132681 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132681 Log: PR c++/35315 * attribs.c (decl_attributes): Leave ATTR_FLAG_TYPE_IN_PLACE alone if it's the naming decl for the type's main variant. * cp/decl.c (grokdeclarator): Allow a typedef of an unnamed struct to name the struct for linkage purposes even if it has attributes. (start_decl): In that case, set ATTR_FLAG_TYPE_IN_PLACE. Added: trunk/gcc/testsuite/g++.dg/ext/attrib32.C Modified: trunk/gcc/ChangeLog trunk/gcc/attribs.c trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c
Subject: Bug 35315 Author: dgregor Date: Fri Feb 29 21:41:38 2008 New Revision: 132779 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132779 Log: 2008-02-29 Douglas Gregor <doug.gregor@gmail.com> PR c++/35315 * tree-inline.c (build_duplicate_type): When we make a duplicate type, make it unique in the canonical types system. 2008-02-29 Douglas Gregor <doug.gregor@gmail.com> PR c++/35315 * g++.dg/ext/attrib32.C: Add another test case. Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/ext/attrib32.C trunk/gcc/tree-inline.c
Subject: Bug 35315 Author: dgregor Date: Sat Mar 1 05:37:41 2008 New Revision: 132798 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132798 Log: 2008-02-29 Douglas Gregor <doug.gregor@gmail.com> PR c++/35315 * tree-inline.c (build_duplicate_type): When we make a duplicate type, make it unique in the canonical types system. 2008-02-29 Douglas Gregor <doug.gregor@gmail.com> PR c++/35315 * g++.dg/ext/attrib32.C: New. Added: branches/gcc-4_3-branch/gcc/testsuite/g++.dg/ext/attrib32.C Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/testsuite/ChangeLog branches/gcc-4_3-branch/gcc/tree-inline.c
Fixed on mainline and 4.3 branch.
Author: jason Date: Fri Mar 18 15:06:41 2011 New Revision: 171145 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171145 Log: PR c++/35315 * c-common.c (handle_transparent_union_attribute): Don't make a duplicate type in C++. Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-common.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/ext/attrib32.C