This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: debug/6436: dwarf2out ICE with typedef using attributes


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]