From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25605 invoked by alias); 30 Sep 2014 14:35:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 25593 invoked by uid 89); 30 Sep 2014 14:35:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 30 Sep 2014 14:35:21 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8UEZICi029980 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 30 Sep 2014 10:35:18 -0400 Received: from [10.10.116.29] ([10.10.116.29]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8UEZG6V000353; Tue, 30 Sep 2014 10:35:17 -0400 Message-ID: <542ABFA1.1080102@redhat.com> Date: Tue, 30 Sep 2014 14:35:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 MIME-Version: 1.0 To: Jan Hubicka , Richard Biener CC: gcc-patches@gcc.gnu.org, ebotcazou@libertysurf.fr, paul@codesourcery.com Subject: Re: Enable TBAA on anonymous types with LTO References: <20140926191400.GB27278@kam.mff.cuni.cz> <20140929153615.GB19673@kam.mff.cuni.cz> In-Reply-To: <20140929153615.GB19673@kam.mff.cuni.cz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2014-09/txt/msg02647.txt.bz2 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