public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/40721] New: [LTO] complains about two tentative definitions
@ 2009-07-11 17:45 rguenth at gcc dot gnu dot org
2009-07-11 17:53 ` [Bug lto/40721] " rguenth at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-11 17:45 UTC (permalink / raw)
To: gcc-bugs
This breaks a lot of benchmarks in SPEC CPU 2000.
t.c
int i;
t2.c
int i;
int main() { return i; }
$ ./xgcc -B. -o t t1.c t2.c
$ ./xgcc -B. -o t t1.c t2.c -flto
t2.c:1:5: error: 'i' has already been defined
t1.c:1:5: error: previously defined here
lto-wrapper: ././xgcc returned 1 exit status
collect2: lto-wrapper returned 1 exit status
the LTO behavior is wrong for C. The testcase would violate the C++ ODR, but
LTO should not reject the valid C program (note ODR violations do not need to
be diagnosed).
--
Summary: [LTO] complains about two tentative definitions
Product: gcc
Version: lto
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: lto
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40721
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/40721] [LTO] complains about two tentative definitions
2009-07-11 17:45 [Bug lto/40721] New: [LTO] complains about two tentative definitions rguenth at gcc dot gnu dot org
@ 2009-07-11 17:53 ` rguenth at gcc dot gnu dot org
2009-07-11 18:05 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-11 17:53 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/40721] [LTO] complains about two tentative definitions
2009-07-11 17:45 [Bug lto/40721] New: [LTO] complains about two tentative definitions rguenth at gcc dot gnu dot org
2009-07-11 17:53 ` [Bug lto/40721] " rguenth at gcc dot gnu dot org
@ 2009-07-11 18:05 ` pinskia at gcc dot gnu dot org
2009-07-11 18:10 ` rguenther at suse dot de
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-07-11 18:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2009-07-11 18:05 -------
Note this is only true for the non -fno-common case. Really this is an
extension to the standard C language but we should support it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40721
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/40721] [LTO] complains about two tentative definitions
2009-07-11 17:45 [Bug lto/40721] New: [LTO] complains about two tentative definitions rguenth at gcc dot gnu dot org
2009-07-11 17:53 ` [Bug lto/40721] " rguenth at gcc dot gnu dot org
2009-07-11 18:05 ` pinskia at gcc dot gnu dot org
@ 2009-07-11 18:10 ` rguenther at suse dot de
2009-07-11 18:19 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenther at suse dot de @ 2009-07-11 18:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rguenther at suse dot de 2009-07-11 18:09 -------
Subject: Re: [LTO] complains about two tentative
definitions
On Sat, 11 Jul 2009, pinskia at gcc dot gnu dot org wrote:
> ------- Comment #2 from pinskia at gcc dot gnu dot org 2009-07-11 18:05 -------
> Note this is only true for the non -fno-common case. Really this is an
> extension to the standard C language but we should support it.
You mean it is only true for -fcommon (which is the default)?
Richard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40721
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/40721] [LTO] complains about two tentative definitions
2009-07-11 17:45 [Bug lto/40721] New: [LTO] complains about two tentative definitions rguenth at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-07-11 18:10 ` rguenther at suse dot de
@ 2009-07-11 18:19 ` pinskia at gcc dot gnu dot org
2009-07-13 5:27 ` bje at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-07-11 18:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2009-07-11 18:19 -------
(In reply to comment #3)
> Subject: Re: [LTO] complains about two tentative
> definitions
>
> On Sat, 11 Jul 2009, pinskia at gcc dot gnu dot org wrote:
>
> > ------- Comment #2 from pinskia at gcc dot gnu dot org 2009-07-11 18:05 -------
> > Note this is only true for the non -fno-common case. Really this is an
> > extension to the standard C language but we should support it.
>
> You mean it is only true for -fcommon (which is the default)?
What I write is the same as what your wrote (I had two negatives ;) .
-- Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40721
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/40721] [LTO] complains about two tentative definitions
2009-07-11 17:45 [Bug lto/40721] New: [LTO] complains about two tentative definitions rguenth at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-07-11 18:19 ` pinskia at gcc dot gnu dot org
@ 2009-07-13 5:27 ` bje at gcc dot gnu dot org
2009-07-13 13:42 ` rguenth at gcc dot gnu dot org
2009-07-13 13:43 ` rguenth at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: bje at gcc dot gnu dot org @ 2009-07-13 5:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from bje at gcc dot gnu dot org 2009-07-13 05:27 -------
Confirmed.
--
bje at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-07-13 05:27:24
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40721
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/40721] [LTO] complains about two tentative definitions
2009-07-11 17:45 [Bug lto/40721] New: [LTO] complains about two tentative definitions rguenth at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-07-13 5:27 ` bje at gcc dot gnu dot org
@ 2009-07-13 13:42 ` rguenth at gcc dot gnu dot org
2009-07-13 13:43 ` rguenth at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-13 13:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from rguenth at gcc dot gnu dot org 2009-07-13 13:42 -------
Subject: Bug 40721
Author: rguenth
Date: Mon Jul 13 13:42:03 2009
New Revision: 149587
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149587
Log:
2009-07-13 Richard Guenther <rguenther@suse.de>
PR lto/40721
* lto-opts.c (register_user_option_p): Handle OPT_fcommon.
(handle_common_option): Likewise.
* lto-symtab.c (lto_symtab_merge_decl): Merge re-definitions
if flag_no_common is not set.
Modified:
branches/lto/gcc/ChangeLog.lto
branches/lto/gcc/lto-opts.c
branches/lto/gcc/lto-symtab.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40721
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug lto/40721] [LTO] complains about two tentative definitions
2009-07-11 17:45 [Bug lto/40721] New: [LTO] complains about two tentative definitions rguenth at gcc dot gnu dot org
` (5 preceding siblings ...)
2009-07-13 13:42 ` rguenth at gcc dot gnu dot org
@ 2009-07-13 13:43 ` rguenth at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-13 13:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from rguenth at gcc dot gnu dot org 2009-07-13 13:43 -------
Fixed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40721
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-07-13 13:43 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-11 17:45 [Bug lto/40721] New: [LTO] complains about two tentative definitions rguenth at gcc dot gnu dot org
2009-07-11 17:53 ` [Bug lto/40721] " rguenth at gcc dot gnu dot org
2009-07-11 18:05 ` pinskia at gcc dot gnu dot org
2009-07-11 18:10 ` rguenther at suse dot de
2009-07-11 18:19 ` pinskia at gcc dot gnu dot org
2009-07-13 5:27 ` bje at gcc dot gnu dot org
2009-07-13 13:42 ` rguenth at gcc dot gnu dot org
2009-07-13 13:43 ` rguenth at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).