public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/64684] New: wrong code by LTO on x86_64-linux-gnu
@ 2015-01-20 7:41 su at cs dot ucdavis.edu
2015-01-20 9:42 ` [Bug lto/64684] [5 Regression] " rguenth at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: su at cs dot ucdavis.edu @ 2015-01-20 7:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64684
Bug ID: 64684
Summary: wrong code by LTO on x86_64-linux-gnu
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
The current gcc trunk miscompiles the following code when using LTO on
x86_64-linux-gnu in both 32-bit and 64-bit modes.
This is a regression from 4.9.x.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 5.0.0 20150119 (experimental) [trunk revision 219832] (GCC)
$
$ gcc-trunk -O1 -c fn1.c
$ gcc-trunk -Os -c fn2.c
$ gcc-trunk -O0 -c main.c
$ gcc-trunk -O0 fn1.o fn2.o main.o
$ ./a.out
$
$
$ gcc-4.9 -flto -O1 -c fn1.c
$ gcc-4.9 -flto -Os -c fn2.c
$ gcc-4.9 -flto -O0 -c main.c
$ gcc-4.9 -flto fn1.o fn2.o main.o
$ ./a.out
$
$ gcc-trunk -flto -O1 -c fn1.c
$ gcc-trunk -flto -Os -c fn2.c
$ gcc-trunk -flto -O0 -c main.c
$ gcc-trunk -flto fn1.o fn2.o main.o
$ ./a.out
Aborted (core dumped)
$
$ cat fn1.c
extern void fn2 (void);
extern int a;
void
fn1 ()
{
a = -1;
fn2 ();
a &= 1;
}
$ cat fn2.c
extern int a;
void
fn2 (void)
{
a = 0;
}
$ cat main.c
extern void fn1 (void);
int a;
int
main ()
{
fn1 ();
if (a != 0)
__builtin_abort ();
return 0;
}
$
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug lto/64684] [5 Regression] wrong code by LTO on x86_64-linux-gnu
2015-01-20 7:41 [Bug lto/64684] New: wrong code by LTO on x86_64-linux-gnu su at cs dot ucdavis.edu
@ 2015-01-20 9:42 ` rguenth at gcc dot gnu.org
2015-01-20 10:30 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-20 9:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64684
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |lto, wrong-code
CC| |hubicka at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
Target Milestone|--- |5.0
Summary|wrong code by LTO on |[5 Regression] wrong code
|x86_64-linux-gnu |by LTO on x86_64-linux-gnu
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I bet this is just the start of interesting bugs with optimization attributes
on all functions...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug lto/64684] [5 Regression] wrong code by LTO on x86_64-linux-gnu
2015-01-20 7:41 [Bug lto/64684] New: wrong code by LTO on x86_64-linux-gnu su at cs dot ucdavis.edu
2015-01-20 9:42 ` [Bug lto/64684] [5 Regression] " rguenth at gcc dot gnu.org
@ 2015-01-20 10:30 ` rguenth at gcc dot gnu.org
2015-01-20 10:41 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-20 10:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64684
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-01-20
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Setting value number of .MEM_7 to .MEM_7 (changed)
Value numbering .MEM_8 stmt = fn2 ();
Setting value number of .MEM_8 to .MEM_8 (changed)
Value numbering _4 stmt = _4 = a;
Setting value number of _4 to -1 (changed)
Value numbering _5 stmt = _5 = _4 & 1;
Match-and-simplified _4 & 1 to 1
RHS _4 & 1 simplified to 1 has constants 1
Setting value number of _5 to 1 (changed)
so fn2 () is said to not clobber 'a'. Must be IPA references fault:
all module statics: a
Function name:fn2/3:
static not read: all module statics
static not written: all module statics
Function name:fn1/0:
static not read: all module statics
static not written: all module statics
that's wrong for both fn1 and fn2. WPA does
Promotable global:a (uid=3959)
Function name:fn2/3:
locals read:
locals written:
Function name:fn1/0:
locals read:
locals written:
And compile-time doesn't have .static-var dumps at all?! Ah, WPA stage
is supposed to generate summaries? But doesn't input nodes?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug lto/64684] [5 Regression] wrong code by LTO on x86_64-linux-gnu
2015-01-20 7:41 [Bug lto/64684] New: wrong code by LTO on x86_64-linux-gnu su at cs dot ucdavis.edu
2015-01-20 9:42 ` [Bug lto/64684] [5 Regression] " rguenth at gcc dot gnu.org
2015-01-20 10:30 ` rguenth at gcc dot gnu.org
@ 2015-01-20 10:41 ` rguenth at gcc dot gnu.org
2015-01-20 10:47 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-20 10:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64684
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ah - you do
if (!is_proper_for_analysis (var))
continue;
bitmap_set_bit (ignore_module_statics, DECL_UID (var));
but is_proper_for_analysis adds to all_module_statics (that's quite a broken
thing for this kind of function...).
I have a patch.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug lto/64684] [5 Regression] wrong code by LTO on x86_64-linux-gnu
2015-01-20 7:41 [Bug lto/64684] New: wrong code by LTO on x86_64-linux-gnu su at cs dot ucdavis.edu
` (2 preceding siblings ...)
2015-01-20 10:41 ` rguenth at gcc dot gnu.org
@ 2015-01-20 10:47 ` rguenth at gcc dot gnu.org
2015-01-20 13:26 ` rguenth at gcc dot gnu.org
2015-01-20 13:27 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-20 10:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64684
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
*** Bug 64685 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug lto/64684] [5 Regression] wrong code by LTO on x86_64-linux-gnu
2015-01-20 7:41 [Bug lto/64684] New: wrong code by LTO on x86_64-linux-gnu su at cs dot ucdavis.edu
` (3 preceding siblings ...)
2015-01-20 10:47 ` rguenth at gcc dot gnu.org
@ 2015-01-20 13:26 ` rguenth at gcc dot gnu.org
2015-01-20 13:27 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-20 13:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64684
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Jan 20 13:26:19 2015
New Revision: 219892
URL: https://gcc.gnu.org/viewcvs?rev=219892&root=gcc&view=rev
Log:
2015-01-20 Richard Biener <rguenther@suse.de>
PR ipa/64684
* ipa-reference.c (add_static_var): Inline ...
(analyze_function): ... here after splitting out from ...
(is_proper_for_analysis): ... this.
* gcc.dg/lto/pr64684_0.c: New testcase.
* gcc.dg/lto/pr64684_1.c: Likewise.
* gcc.dg/lto/pr64684_2.c: Likewise.
* gcc.dg/lto/pr64685_0.c: Likewise.
* gcc.dg/lto/pr64685_1.c: Likewise.
Added:
trunk/gcc/testsuite/gcc.dg/lto/pr64684_0.c
trunk/gcc/testsuite/gcc.dg/lto/pr64684_1.c
trunk/gcc/testsuite/gcc.dg/lto/pr64684_2.c
trunk/gcc/testsuite/gcc.dg/lto/pr64685_0.c
trunk/gcc/testsuite/gcc.dg/lto/pr64685_1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-reference.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug lto/64684] [5 Regression] wrong code by LTO on x86_64-linux-gnu
2015-01-20 7:41 [Bug lto/64684] New: wrong code by LTO on x86_64-linux-gnu su at cs dot ucdavis.edu
` (4 preceding siblings ...)
2015-01-20 13:26 ` rguenth at gcc dot gnu.org
@ 2015-01-20 13:27 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-20 13:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64684
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-01-20 13:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-20 7:41 [Bug lto/64684] New: wrong code by LTO on x86_64-linux-gnu su at cs dot ucdavis.edu
2015-01-20 9:42 ` [Bug lto/64684] [5 Regression] " rguenth at gcc dot gnu.org
2015-01-20 10:30 ` rguenth at gcc dot gnu.org
2015-01-20 10:41 ` rguenth at gcc dot gnu.org
2015-01-20 10:47 ` rguenth at gcc dot gnu.org
2015-01-20 13:26 ` rguenth at gcc dot gnu.org
2015-01-20 13:27 ` rguenth at gcc dot gnu.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).