public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446
@ 2021-05-12 12:27 jakub at gcc dot gnu.org
2021-05-12 12:27 ` [Bug tree-optimization/100566] " jakub at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-12 12:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
Bug ID: 100566
Summary: [11/12 Regression] Miscompilation of mausezahn since
r11-2446
Product: gcc
Version: 11.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Target Milestone: ---
The following testcase is miscompiled at -O2 since
r11-2446-g3e61a2056335ca7d4e2009823efae4ee2dc950ee
- it loops endlessly instead of terminating.
struct S { unsigned int s1, s2; int s3, s4, s5, s6, s7; unsigned int s8; };
struct S s;
enum E { E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14, E15 };
enum E e;
int f, g, h;
__attribute__((noipa)) void fn1 (void *l)
{
asm volatile ("" : : "r" (l) : "memory");
}
__attribute__((noipa)) int fn2 (void *l)
{
asm volatile ("" : : "r" (l) : "memory");
return 0;
}
__attribute__((noipa)) int fn3 (void)
{
asm volatile ("" : : : "memory");
return 0;
}
__attribute__((nothrow, leaf, noipa)) int fn4 (void)
{
asm volatile ("" : : : "memory");
return 0;
}
__attribute__((noipa)) int fn5 (unsigned int l)
{
asm volatile ("" : : "r" (l) : "memory");
return 0;
}
__attribute__((noipa)) int fn6 (void *l, int t)
{
asm volatile ("" : : "r" (l), "r" (t) : "memory");
return 0;
}
__attribute__((noipa)) int fn7 (void *l, int t)
{
asm volatile ("" : : "r" (l), "r" (t) : "memory");
return 0;
}
__attribute__((noipa)) int fn8 (void *l, int t)
{
asm volatile ("" : : "r" (l), "r" (t) : "memory");
return 0;
}
__attribute__((noipa)) int fn9 (void *l, int t)
{
asm volatile ("" : : "r" (l), "r" (t) : "memory");
return 0;
}
__attribute__((noipa)) int fn10 (void *l, int t)
{
asm volatile ("" : : "r" (l), "r" (t) : "memory");
return 0;
}
__attribute__((noipa)) int fn11 (void *l, int t)
{
asm volatile ("" : : "r" (l), "r" (t) : "memory");
return 0;
}
__attribute__((noipa)) int fn12 (void *l, int t)
{
asm volatile ("" : : "r" (l), "r" (t) : "memory");
return 0;
}
__attribute__((noipa)) int fn13 (void *l, int t)
{
asm volatile ("" : : "r" (l), "r" (t) : "memory");
return 0;
}
__attribute__((noipa)) int fn14 (void *l, int t)
{
asm volatile ("" : : "r" (l), "r" (t) : "memory");
return 0;
}
__attribute__((noipa))
int test (void *l, int y, int z)
{
int i = 0, s1;
int s8, s7, s6, s5, s4, j = 0;
s1 = s.s1;
s8 = s.s8;
s7 = s.s7;
s6 = s.s6;
s5 = s.s5;
s4 = s.s4 | s.s3;
if (e == E11)
j = 1;
if (s1 == 0)
goto lab;
for (i = 0; i < s1; i++)
{
lab:
if (f)
{
switch (e)
{
case E6:
fn12 (l, z);
break;
case E7:
case E9:
case E11:
case E13:
fn13 (l, z);
break;
case E8:
fn14 (l, z);
break;
}
}
if (g)
fn3 ();
fn2 (l);
if (h)
s.s2 = (unsigned int) s.s2 * fn4 () / 2147483647;
if (s.s2)
fn5 (s.s2);
if (s8)
{
if (fn11 (l, z) == 0)
goto lab;
}
if (s7)
{
if (fn9 (l, z) == 0)
goto lab;
}
if (s6)
{
if (fn10 (l, z) == 0)
goto lab;
}
if (s5)
{
if (fn8 (l, y) == 0)
goto lab;
}
if (s4)
{
if (fn7 (l, y) == 0)
goto lab;
}
if (j)
fn6 (l, z);
if (!s1)
goto lab;
}
fn1 (l);
return 0;
}
int
main ()
{
asm volatile ("" : : "g" (&s), "g" (&e), "g" (&f), "g" (&g), "g" (&h) :
"memory");
s.s1 = 1;
e = E7;
test (0, 2, 1);
return 0;
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/100566] [11/12 Regression] Miscompilation of mausezahn since r11-2446
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
@ 2021-05-12 12:27 ` jakub at gcc dot gnu.org
2021-05-12 12:47 ` jakub at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-12 12:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
CC| |rguenth at gcc dot gnu.org
Last reconfirmed| |2021-05-12
Priority|P3 |P2
Status|UNCONFIRMED |NEW
Target Milestone|--- |11.2
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/100566] [11/12 Regression] Miscompilation of mausezahn since r11-2446
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
2021-05-12 12:27 ` [Bug tree-optimization/100566] " jakub at gcc dot gnu.org
@ 2021-05-12 12:47 ` jakub at gcc dot gnu.org
2021-05-12 12:48 ` [Bug tree-optimization/100566] [11/12 Regression] Miscompilation of mausezahn since r9-2635 jakub at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-12 12:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Though, on more reduced testcase from that it started already in
r9-2635-g78ea9abc2018243af7f7ada6135144ac90c6ad27
(likewise at -O2):
volatile int s, c;
__attribute__((noipa)) void
foo (void)
{
if (c++ > 1)
__builtin_abort ();
}
__attribute__((noipa)) int
bar (void)
{
int i = 0, j = s;
if (j == 0)
goto lab;
for (i = 0; i < j; i++)
{
lab:
foo ();
if (!j)
goto lab;
}
return 0;
}
int
main ()
{
s = 1;
bar ();
if (c != 1)
__builtin_abort ();
return 0;
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/100566] [11/12 Regression] Miscompilation of mausezahn since r9-2635
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
2021-05-12 12:27 ` [Bug tree-optimization/100566] " jakub at gcc dot gnu.org
2021-05-12 12:47 ` jakub at gcc dot gnu.org
@ 2021-05-12 12:48 ` jakub at gcc dot gnu.org
2021-05-12 12:54 ` [Bug tree-optimization/100566] [9/10/11/12 " rguenth at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-12 12:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.2 |9.4
Summary|[11/12 Regression] |[11/12 Regression]
|Miscompilation of mausezahn |Miscompilation of mausezahn
|since r11-2446 |since r9-2635
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/100566] [9/10/11/12 Regression] Miscompilation of mausezahn since r9-2635
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
` (2 preceding siblings ...)
2021-05-12 12:48 ` [Bug tree-optimization/100566] [11/12 Regression] Miscompilation of mausezahn since r9-2635 jakub at gcc dot gnu.org
@ 2021-05-12 12:54 ` rguenth at gcc dot gnu.org
2021-05-12 12:59 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-12 12:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
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
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/100566] [9/10/11/12 Regression] Miscompilation of mausezahn since r9-2635
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
` (3 preceding siblings ...)
2021-05-12 12:54 ` [Bug tree-optimization/100566] [9/10/11/12 " rguenth at gcc dot gnu.org
@ 2021-05-12 12:59 ` jakub at gcc dot gnu.org
2021-05-12 13:43 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-12 12:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The r9-2635 change miscompiles it during PRE,
<bb 2> [local count: 347387062]:
j_7 ={v} s;
if (j_7 == 0)
goto <bb 3>; [34.00%]
else
goto <bb 6>; [66.00%]
<bb 3> [local count: 291805133]:
# i_8 = PHI <0(2), i_2(6)>
<bb 4> [local count: 1073741825]:
foo ();
if (j_7 == 0)
goto <bb 8>; [89.00%]
else
goto <bb 5>; [11.00%]
<bb 8> [local count: 955630225]:
goto <bb 4>; [100.00%]
<bb 5> [local count: 118111601]:
i_10 = i_8 + 1;
<bb 6> [local count: 347387062]:
# i_2 = PHI <i_10(5), 0(2)>
if (i_2 < j_7)
goto <bb 3>; [50.00%]
else
goto <bb 7>; [50.00%]
<bb 7> [local count: 173693531]:
return 0;
looks ok, but PRE assumes the second j_7 == 0 is always true and thus turns the
foo () call into a tight endless loop:
<bb 4> [local count: 1073741825]:
foo ();
goto <bb 4>; [100.00%]
That is the intention of the testcase when s == 0, but not otherwise.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/100566] [9/10/11/12 Regression] Miscompilation of mausezahn since r9-2635
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
` (4 preceding siblings ...)
2021-05-12 12:59 ` jakub at gcc dot gnu.org
@ 2021-05-12 13:43 ` rguenth at gcc dot gnu.org
2021-05-12 15:01 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-12 13:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 50801
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50801&action=edit
patch
OK, so the issue is that predication is still bogus (similar to the other PR)
and we're treating a non-executable backedge optimistically here.
testing the attached
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/100566] [9/10/11/12 Regression] Miscompilation of mausezahn since r9-2635
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
` (5 preceding siblings ...)
2021-05-12 13:43 ` rguenth at gcc dot gnu.org
@ 2021-05-12 15:01 ` cvs-commit at gcc dot gnu.org
2021-05-12 15:58 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-12 15:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
--- Comment #5 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:097fde5e7514e909f2e8472be2e008d0cab2260d
commit r12-750-g097fde5e7514e909f2e8472be2e008d0cab2260d
Author: Richard Biener <rguenther@suse.de>
Date: Wed May 12 15:39:52 2021 +0200
tree-optimization/100566 - fix another predication issue in VN
This amends the fix for PR100053 where I failed to amend all edge
tests in dominated_by_p_w_unex.
2021-05-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/100566
* tree-ssa-sccvn.c (dominated_by_p_w_unex): Properly handle
allow_back for all edge queries.
* gcc.dg/torture/pr100566.c: New testcase.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/100566] [9/10/11/12 Regression] Miscompilation of mausezahn since r9-2635
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
` (6 preceding siblings ...)
2021-05-12 15:01 ` cvs-commit at gcc dot gnu.org
@ 2021-05-12 15:58 ` cvs-commit at gcc dot gnu.org
2021-05-17 7:47 ` [Bug tree-optimization/100566] [9/10 " cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-12 15:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:ce3c70e9ed265578be896b8f7711851b0a7273f1
commit r11-8405-gce3c70e9ed265578be896b8f7711851b0a7273f1
Author: Richard Biener <rguenther@suse.de>
Date: Wed May 12 15:39:52 2021 +0200
tree-optimization/100566 - fix another predication issue in VN
This amends the fix for PR100053 where I failed to amend all edge
tests in dominated_by_p_w_unex.
2021-05-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/100566
* tree-ssa-sccvn.c (dominated_by_p_w_unex): Properly handle
allow_back for all edge queries.
* gcc.dg/torture/pr100566.c: New testcase.
(cherry picked from commit 097fde5e7514e909f2e8472be2e008d0cab2260d)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/100566] [9/10 Regression] Miscompilation of mausezahn since r9-2635
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
` (7 preceding siblings ...)
2021-05-12 15:58 ` cvs-commit at gcc dot gnu.org
@ 2021-05-17 7:47 ` cvs-commit at gcc dot gnu.org
2021-05-17 8:17 ` cvs-commit at gcc dot gnu.org
2021-05-17 8:18 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-17 7:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:9ddc622a15d05510e7ab17ca1584d7fdb828d64e
commit r10-9828-g9ddc622a15d05510e7ab17ca1584d7fdb828d64e
Author: Richard Biener <rguenther@suse.de>
Date: Wed May 12 15:39:52 2021 +0200
tree-optimization/100566 - fix another predication issue in VN
This amends the fix for PR100053 where I failed to amend all edge
tests in dominated_by_p_w_unex.
2021-05-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/100566
* tree-ssa-sccvn.c (dominated_by_p_w_unex): Properly handle
allow_back for all edge queries.
* gcc.dg/torture/pr100566.c: New testcase.
(cherry picked from commit 097fde5e7514e909f2e8472be2e008d0cab2260d)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/100566] [9/10 Regression] Miscompilation of mausezahn since r9-2635
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
` (8 preceding siblings ...)
2021-05-17 7:47 ` [Bug tree-optimization/100566] [9/10 " cvs-commit at gcc dot gnu.org
@ 2021-05-17 8:17 ` cvs-commit at gcc dot gnu.org
2021-05-17 8:18 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-17 8:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:c8938332efa5ca5926b6f349e13b251e52bc2383
commit r9-9535-gc8938332efa5ca5926b6f349e13b251e52bc2383
Author: Richard Biener <rguenther@suse.de>
Date: Wed May 12 15:39:52 2021 +0200
tree-optimization/100566 - fix another predication issue in VN
This amends the fix for PR100053 where I failed to amend all edge
tests in dominated_by_p_w_unex.
2021-05-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/100566
* tree-ssa-sccvn.c (dominated_by_p_w_unex): Properly handle
allow_back for all edge queries.
* gcc.dg/torture/pr100566.c: New testcase.
(cherry picked from commit 097fde5e7514e909f2e8472be2e008d0cab2260d)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/100566] [9/10 Regression] Miscompilation of mausezahn since r9-2635
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
` (9 preceding siblings ...)
2021-05-17 8:17 ` cvs-commit at gcc dot gnu.org
@ 2021-05-17 8:18 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-17 8:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.3.0, 9.3.0
Known to work| |10.3.1, 9.3.1
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-05-17 8:18 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
2021-05-12 12:27 ` [Bug tree-optimization/100566] " jakub at gcc dot gnu.org
2021-05-12 12:47 ` jakub at gcc dot gnu.org
2021-05-12 12:48 ` [Bug tree-optimization/100566] [11/12 Regression] Miscompilation of mausezahn since r9-2635 jakub at gcc dot gnu.org
2021-05-12 12:54 ` [Bug tree-optimization/100566] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-05-12 12:59 ` jakub at gcc dot gnu.org
2021-05-12 13:43 ` rguenth at gcc dot gnu.org
2021-05-12 15:01 ` cvs-commit at gcc dot gnu.org
2021-05-12 15:58 ` cvs-commit at gcc dot gnu.org
2021-05-17 7:47 ` [Bug tree-optimization/100566] [9/10 " cvs-commit at gcc dot gnu.org
2021-05-17 8:17 ` cvs-commit at gcc dot gnu.org
2021-05-17 8:18 ` 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).