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: Enable TBAA on anonymous types with LTO


On 09/29/2014 11:36 AM, Jan Hubicka wrote:
If C++ FE sets canonical type always to main variant, it should work.
Is it always the case?

No. For a compound type like a pointer or function the canonical type strips all typedefs, but a main variant does not.

       namespace {
       struct B {};
       }
       struct A
       {
	void t(B);
	void t2();
       };

Yep, A seems to be not anonymous and mangled as A.  I think it is ODR violation
to declare such type in more than one compilation unit (and we will warn on
it). We can make it anonymous, but I think it is C++ FE to do so.

Yes, it's an ODR violation. The FE currently warns about a field with internal type, and I suppose could warn about other members as well.

I really think that anonymous types are meant to not be accessible from other
compilation unit and I do not see why other languages need different rule.

Agreed.

This does not work for types build from ODR types that are not ODR themselves.

I'm not sure what you mean. In C++ the only types not subject to the ODR are local to one translation unit, so merging isn't an issue. Do you mean types from other languages?

Jason


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