From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29273 invoked by alias); 26 Nov 2010 17:06:36 -0000 Received: (qmail 29249 invoked by uid 22791); 26 Nov 2010 17:06:34 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_DB X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Nov 2010 17:06:28 +0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/44871] Invalid type mismatches while merging C and C++ sources X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: lto X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Fri, 26 Nov 2010 17:20:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-11/txt/msg03277.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44871 --- Comment #13 from Richard Guenther 2010-11-26 17:06:25 UTC --- Testcase: > cat gcc/testsuite/g++.dg/lto/20101126-1_0.C typedef struct { int i; } T1; typedef T1 T2; extern T1 a; extern T2 b; int main() { return a.i + b.i; } > cat gcc/testsuite/g++.dg/lto/20101126-1_1.c typedef struct { int i; } T1; typedef T1 T2; T1 a; T2 b; /space/rguenther/src/svn/trunk/gcc/testsuite/g++.dg/lto/20101126-1_0.C:3:11: warning: type of 'a' does not match original declaration [enabled by default]^M /space/rguenther/src/svn/trunk/gcc/testsuite/g++.dg/lto/20101126-1_1.c:3:4: note: previously declared here^M /space/rguenther/src/svn/trunk/gcc/testsuite/g++.dg/lto/20101126-1_0.C:4:11: warning: type of 'b' does not match original declaration [enabled by default]^M /space/rguenther/src/svn/trunk/gcc/testsuite/g++.dg/lto/20101126-1_1.c:4:4: note: previously declared here^M (gdb) call debug_tree (prevailing->decl) unit size align 32 symtab 0 alias set -1 structural equality fields nonlocal SI file t4.ii line 1 col 22 size unit size align 32 offset_align 128 offset bit offset context >> public static SI file t4.ii line 3 col 4 size unit size align 32 context > (gdb) call debug_tree (decl) unit size align 32 symtab 0 alias set -1 structural equality fields SI file t3.i line 1 col 22 size unit size align 32 offset_align 128 offset bit offset context >> used public external common SI file t3.i line 3 col 11 size unit size align 32 context > if we want to have the same canonical type for the above we can simply disregard all names, which makes sense for canonical type merging, but that makes the hash functions very weak again (we share the type hashes for type and canonical type merging). It also can run foul of too much merging when facing incomplete types which can happen in various places.