This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/40721] [LTO] complains about two tentative definitions
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Jul 2009 17:53:15 -0000
- Subject: [Bug lto/40721] [LTO] complains about two tentative definitions
- References: <bug-40721-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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