From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2435 invoked by alias); 11 Jul 2009 17:53:28 -0000 Received: (qmail 2401 invoked by uid 48); 11 Jul 2009 17:53:15 -0000 Date: Sat, 11 Jul 2009 17:53:00 -0000 Message-ID: <20090711175315.2400.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug lto/40721] [LTO] complains about two tentative definitions In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" 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: 2009-07/txt/msg00933.txt.bz2 ------- Comment #1 from rguenth at gcc dot gnu dot org 2009-07-11 17:53 ------- Cases like t1.c int i = 2; t2.c int i = 1; int main() { return i; } are diagnosed by the linker - not ideal, but not different from -fno-lto either. Index: lto-symtab.c =================================================================== --- lto-symtab.c (revision 149512) +++ lto-symtab.c (working copy) @@ -568,15 +568,17 @@ lto_symtab_merge_decl (tree new_decl, if (resolution == LDPR_PREVAILING_DEF || resolution == LDPR_PREVAILING_DEF_IRONLY) { - if (old_resolution == LDPR_PREVAILING_DEF - || old_resolution == LDPR_PREVAILING_DEF_IRONLY) + if ((old_resolution == LDPR_PREVAILING_DEF + || old_resolution == LDPR_PREVAILING_DEF_IRONLY) + && old_resolution != resolution) { error ("%J%qD has already been defined", new_decl, new_decl); error ("%Jpreviously defined here", old_decl); return; } gcc_assert (old_resolution == LDPR_PREEMPTED_IR - || old_resolution == LDPR_RESOLVED_IR); + || old_resolution == LDPR_RESOLVED_IR + || old_resolution == resolution); lto_symtab_set_identifier_decl (name, new_decl); return; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40721