public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/97135] New: [11 Regression] Wrong code at -Os since r11-408-g84935c98221
@ 2020-09-21 8:36 acoplan at gcc dot gnu.org
2020-09-21 8:53 ` [Bug tree-optimization/97135] " jakub at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: acoplan at gcc dot gnu.org @ 2020-09-21 8:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97135
Bug ID: 97135
Summary: [11 Regression] Wrong code at -Os since
r11-408-g84935c98221
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: acoplan at gcc dot gnu.org
Target Milestone: ---
For the following testcase:
long c;
long *d = &c;
int a, e, f;
int main(void) {
for (; f <= 5; f++) {
e = 0;
for (; e <= 5; e++) {
a = 1;
for (; a <= 5; a++);
*d = 0;
if (f)
break;
}
}
return a;
}
Compiling with -O{0,1,2,3} (for both gcc and clang), as expected, the program
returns 6.
Compiling with -Os, the program returns 1 (since
r11-408-g84935c9822183ce403bb361c5f405711b9a808c6).
I've reproduced this on both x86 and aarch64. Interestingly, compiling with -Os
-fno-strict-aliasing, we no longer see the wrong code bug (the program returns
6). However, I believe this program is free of strict aliasing violations.
To reproduce:
$ bin/gcc wrong_code.c
$ ./a.out || echo $?
6
$ bin/gcc wrong_code.c -Os
$ ./a.out || echo $?
1
$ bin/gcc wrong_code.c -Os -fno-strict-aliasing
$ ./a.out || echo $?
6
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/97135] [11 Regression] Wrong code at -Os since r11-408-g84935c98221
2020-09-21 8:36 [Bug tree-optimization/97135] New: [11 Regression] Wrong code at -Os since r11-408-g84935c98221 acoplan at gcc dot gnu.org
@ 2020-09-21 8:53 ` jakub at gcc dot gnu.org
2020-09-21 10:38 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-21 8:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97135
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2020-09-21
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Slightly adjusted testcase for the testsuite (gcc.c-torture/execute/ ?):
long long e, *d = &e;
int a, b, c;
int
main ()
{
for (; c <= 5; c++)
for (b = 0; b <= 5; b++)
{
for (a = 1; a <= 5; a++)
;
*d = 0;
if (c)
break;
}
if (a != 6)
__builtin_abort ();
return 0;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/97135] [11 Regression] Wrong code at -Os since r11-408-g84935c98221
2020-09-21 8:36 [Bug tree-optimization/97135] New: [11 Regression] Wrong code at -Os since r11-408-g84935c98221 acoplan at gcc dot gnu.org
2020-09-21 8:53 ` [Bug tree-optimization/97135] " jakub at gcc dot gnu.org
@ 2020-09-21 10:38 ` rguenth at gcc dot gnu.org
2020-09-21 10:50 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-21 10:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97135
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Status|NEW |ASSIGNED
Target Milestone|--- |11.0
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'll have a look.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/97135] [11 Regression] Wrong code at -Os since r11-408-g84935c98221
2020-09-21 8:36 [Bug tree-optimization/97135] New: [11 Regression] Wrong code at -Os since r11-408-g84935c98221 acoplan at gcc dot gnu.org
2020-09-21 8:53 ` [Bug tree-optimization/97135] " jakub at gcc dot gnu.org
2020-09-21 10:38 ` rguenth at gcc dot gnu.org
@ 2020-09-21 10:50 ` rguenth at gcc dot gnu.org
2020-09-21 12:06 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-21 10:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97135
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's lim4 that does the bogus transform. It seems to be confused by the dead
store in BB3:
<bb 3> [local count: 118111600]:
a = 1;
a = 6;
*d.2_3 = 0;
ivtmp.15_9 = ivtmp.15_24 + 1;
if (c.7_7 != 0)
goto <bb 9>; [5.50%]
else
goto <bb 10>; [94.50%]
and re-materializes the a = 1 store but not the a = 6 one.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/97135] [11 Regression] Wrong code at -Os since r11-408-g84935c98221
2020-09-21 8:36 [Bug tree-optimization/97135] New: [11 Regression] Wrong code at -Os since r11-408-g84935c98221 acoplan at gcc dot gnu.org
` (2 preceding siblings ...)
2020-09-21 10:50 ` rguenth at gcc dot gnu.org
@ 2020-09-21 12:06 ` cvs-commit at gcc dot gnu.org
2020-09-21 12:07 ` rguenth at gcc dot gnu.org
2020-09-22 6:40 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-21 12:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97135
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:0df746afc50a47d1eb53a401e017c4373cf05641
commit r11-3321-g0df746afc50a47d1eb53a401e017c4373cf05641
Author: Richard Biener <rguenther@suse.de>
Date: Mon Sep 21 14:04:25 2020 +0200
tree-optimization/97135 - fix dependence check in store-motion
The following fixes a dependence check where in the particular place
we cannot ignore self-dependences.
2020-09-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/97135
* tree-ssa-loop-im.c (sm_seq_push_down): Do not ignore
self-dependences.
* gcc.dg/torture/pr97135.c: New testcase.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/97135] [11 Regression] Wrong code at -Os since r11-408-g84935c98221
2020-09-21 8:36 [Bug tree-optimization/97135] New: [11 Regression] Wrong code at -Os since r11-408-g84935c98221 acoplan at gcc dot gnu.org
` (3 preceding siblings ...)
2020-09-21 12:06 ` cvs-commit at gcc dot gnu.org
@ 2020-09-21 12:07 ` rguenth at gcc dot gnu.org
2020-09-22 6:40 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-21 12:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97135
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/97135] [11 Regression] Wrong code at -Os since r11-408-g84935c98221
2020-09-21 8:36 [Bug tree-optimization/97135] New: [11 Regression] Wrong code at -Os since r11-408-g84935c98221 acoplan at gcc dot gnu.org
` (4 preceding siblings ...)
2020-09-21 12:07 ` rguenth at gcc dot gnu.org
@ 2020-09-22 6:40 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-22 6:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97135
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |stefansf at linux dot ibm.com
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
*** Bug 97152 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-09-22 6:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 8:36 [Bug tree-optimization/97135] New: [11 Regression] Wrong code at -Os since r11-408-g84935c98221 acoplan at gcc dot gnu.org
2020-09-21 8:53 ` [Bug tree-optimization/97135] " jakub at gcc dot gnu.org
2020-09-21 10:38 ` rguenth at gcc dot gnu.org
2020-09-21 10:50 ` rguenth at gcc dot gnu.org
2020-09-21 12:06 ` cvs-commit at gcc dot gnu.org
2020-09-21 12:07 ` rguenth at gcc dot gnu.org
2020-09-22 6:40 ` 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).