This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: debug/6436: dwarf2out ICE with typedef using attributes
- From: Jason Merrill <jason at redhat dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: jakub at gcc dot gnu dot org, <gcc-bugs at gcc dot gnu dot org>, <meissner at suse dot de>,<gcc-gnats at gcc dot gnu dot org>, <gcc-patches at gcc dot gnu dot org>,Mark Mitchell <mark at codesourcery dot com>,Richard Sandiford <rsandifo at redhat dot com>
- Date: Tue, 30 Apr 2002 11:01:51 +0100
- Subject: Re: debug/6436: dwarf2out ICE with typedef using attributes
- References: <Pine.LNX.4.44.0204291417040.3511-100000@dberlin.org>
>>>>> "Daniel" == Daniel Berlin <dberlin@dberlin.org> writes:
> For C++, we output two *named* types first, ._0, which is the A *without*
> alignment, then ._1, which is the A *with* alignment.
Actually, ._1 is B. The C++ standard says
If the typedef declaration defines an unnamed class (or enum), the
first typedef-name declared by the declaration to be that class type
(or enum type) is used to denote the class type (or enum type) for
linkage purposes only.
So we set TYPE_NAME for the type to be the typedef, rather than the funny
internal name. For B this is fine, because the type of the name B is the
struct itself. For A we have a problem: the type of the name A is an
attribute-variant of the anonymous struct, but we set the struct's name
anyway. So
TREE_TYPE (TYPE_NAME (type)) != type
but
DECL_ORIGINAL_TYPE (TYPE_NAME (type)) == type
One fix would be to not give the name 'A' to the anonymous struct.
However, that would mean that we couldn't use the type in a mangled
context, and I suspect that there is code out there that relies on this
sort of pattern, though I suppose it's easy enough to fix affected code by
adding an "A" after the "struct" tag.
Jason