From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66056 invoked by alias); 11 May 2015 21:39:55 -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 66042 invoked by uid 89); 11 May 2015 21:39:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 11 May 2015 21:39:53 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id ECC7454102B; Mon, 11 May 2015 23:39:49 +0200 (CEST) Date: Mon, 11 May 2015 21:52:00 -0000 From: Jan Hubicka To: Jason Merrill Cc: Jan Hubicka , gcc-patches@gcc.gnu.org Subject: Re: False ODR violation positives on anonymous namespace types Message-ID: <20150511213949.GB35526@kam.mff.cuni.cz> References: <20150511142810.GA6584@kam.mff.cuni.cz> <5550E3D2.2080408@redhat.com> <20150511174607.GB59663@kam.mff.cuni.cz> <5550ECB5.8000607@redhat.com> <20150511180509.GB22960@kam.mff.cuni.cz> <55511D40.1010808@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55511D40.1010808@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2015-05/txt/msg01023.txt.bz2 > On 05/11/2015 01:05 PM, Jan Hubicka wrote: > >>On 05/11/2015 12:46 PM, Jan Hubicka wrote: > >>>Well, my main motivatoin to extend from RECORD_OR_UNION_TYPE_P was to handle > >>>enums. But other case I would like to deal with are integer types - i.e. preserve > >>>difference between char/signed char/unsigned char/short/int/long/wchar in cases > >>>where they structurally coincide. > >> > >>In what context? Won't you get that from comparing e.g. the field > >>types of two definitions of the same class? > > > >If one class define "int foo;" and other "long foo;" we currently do not complain > >about ODR on 32bit targets while I think we could. > > We certainly should. But that's a problem because foo is subject to > the ODR. I don't see why you need to treat int as an ODR type to > get checking for foo. What happens in LTO is that lto-symtab decide to merge the two declarations of foo. At this time it has chance to output the warning. For that it needs to be able to work out that these declarations are having different types, but because LTO merge canonical types on structural basis, types_compatible_p (long, int) will return true. The idea behind LTO canonical type computation is that it needs to safely work cross-language and if the two declarations came from C and fortran, the mismatch in type name is useless (see gimple_canonical_types_compatible_p) So what I want is to have odr_or_derived_type_p to return true on those types (because it sees they do have mangled name attached) and then call odr_types_equivalent_p which is the same comparer I use to output ODR waring about types and it will complain about mangled type names being different. This is already implemented in https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00870.html Honza > > Jason