public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/103063] New: Wrong code while using -O3
@ 2021-11-03 16:04 stefansf at linux dot ibm.com
2021-11-03 17:23 ` [Bug tree-optimization/103063] " marxin at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: stefansf at linux dot ibm.com @ 2021-11-03 16:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103063
Bug ID: 103063
Summary: Wrong code while using -O3
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: stefansf at linux dot ibm.com
Target Milestone: ---
int a = 0;
unsigned char b = 0;
int main() {
a - 6;
for (; a >= -13; a = a - 8)
while((unsigned char)(b-- * 6))
;
if (b != 127)
__builtin_abort();
return 0;
}
Running the example while compiled with -O{0,1,2} works fine whereas it fails
with -O{3,fast} using gcc-12-4860-g73658e70d9e. Couldn't find a good commit so
far. Fails on IBM Z as well as x64.
Still not sure where it fails. ifcvt looks good to me.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/103063] Wrong code while using -O3
2021-11-03 16:04 [Bug tree-optimization/103063] New: Wrong code while using -O3 stefansf at linux dot ibm.com
@ 2021-11-03 17:23 ` marxin at gcc dot gnu.org
2021-11-03 17:25 ` [Bug tree-optimization/103063] [9/10/11/12 Regression] Wrong code while using -O3 since r7-2373-g69b806f6a60efcf1 pinskia at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-03 17:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103063
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amker at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
Last reconfirmed| |2021-11-03
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=100499
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Keywords| |wrong-code
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r7-2373-g69b806f6a60efcf1.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/103063] [9/10/11/12 Regression] Wrong code while using -O3 since r7-2373-g69b806f6a60efcf1
2021-11-03 16:04 [Bug tree-optimization/103063] New: Wrong code while using -O3 stefansf at linux dot ibm.com
2021-11-03 17:23 ` [Bug tree-optimization/103063] " marxin at gcc dot gnu.org
@ 2021-11-03 17:25 ` pinskia at gcc dot gnu.org
2021-11-04 9:02 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-03 17:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103063
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |9.5
Summary|Wrong code while using -O3 |[9/10/11/12 Regression]
|since |Wrong code while using -O3
|r7-2373-g69b806f6a60efcf1 |since
| |r7-2373-g69b806f6a60efcf1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/103063] [9/10/11/12 Regression] Wrong code while using -O3 since r7-2373-g69b806f6a60efcf1
2021-11-03 16:04 [Bug tree-optimization/103063] New: Wrong code while using -O3 stefansf at linux dot ibm.com
2021-11-03 17:23 ` [Bug tree-optimization/103063] " marxin at gcc dot gnu.org
2021-11-03 17:25 ` [Bug tree-optimization/103063] [9/10/11/12 Regression] Wrong code while using -O3 since r7-2373-g69b806f6a60efcf1 pinskia at gcc dot gnu.org
@ 2021-11-04 9:02 ` rguenth at gcc dot gnu.org
2022-01-19 16:33 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-04 9:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103063
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
CC| |rguenth at gcc dot gnu.org
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
-fdisable-tree-cunroll or -fno-tree-vectorize avoid the miscompile, the key is
probably one of
t.c:7:11: optimized: loop with 14 iterations completely unrolled (header
execution count 21807684)
t.c:4:5: optimized: loop with 7 iterations completely unrolled (header
execution count 29666503)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/103063] [9/10/11/12 Regression] Wrong code while using -O3 since r7-2373-g69b806f6a60efcf1
2021-11-03 16:04 [Bug tree-optimization/103063] New: Wrong code while using -O3 stefansf at linux dot ibm.com
` (2 preceding siblings ...)
2021-11-04 9:02 ` rguenth at gcc dot gnu.org
@ 2022-01-19 16:33 ` jakub at gcc dot gnu.org
2022-01-19 16:35 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-19 16:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103063
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Unless I'm missing something, the outer loop iterates with a = -6,
b is 0, so (unsigned char) (b-- * 6) is 0 (so the inner loop doesn't iterate
further) and b is decremented to 255.
Next a = a - 8 makes a = -14 out of that, so the outer loop doesn't iterate any
longer, so abort is what the test should do (unless changed to b != 255).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/103063] [9/10/11/12 Regression] Wrong code while using -O3 since r7-2373-g69b806f6a60efcf1
2021-11-03 16:04 [Bug tree-optimization/103063] New: Wrong code while using -O3 stefansf at linux dot ibm.com
` (3 preceding siblings ...)
2022-01-19 16:33 ` jakub at gcc dot gnu.org
@ 2022-01-19 16:35 ` jakub at gcc dot gnu.org
2022-01-19 17:42 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-19 16:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103063
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Oops, no, the a - 6 is there just to confuse me, it does nothing and can be
safely dropped (I didn't like it before the loop, misread it and made it for (a
= -6; a >= -13; a = a - 8)).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/103063] [9/10/11/12 Regression] Wrong code while using -O3 since r7-2373-g69b806f6a60efcf1
2021-11-03 16:04 [Bug tree-optimization/103063] New: Wrong code while using -O3 stefansf at linux dot ibm.com
` (4 preceding siblings ...)
2022-01-19 16:35 ` jakub at gcc dot gnu.org
@ 2022-01-19 17:42 ` jakub at gcc dot gnu.org
2022-01-20 7:04 ` rguenth at gcc dot gnu.org
2022-01-24 13:16 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-19 17:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103063
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
ifcvt dump looks correct to me, in vect it seems the vectorizer thinks it can
compute the number of iterations of the inner loop using:
_33 = b_lsm.8_5 * 6;
_34 = _33 / 6;
niters.11_32 = _34 + 1;
_42 = b_lsm.8_5 * 6;
if (_42 <= 89)
For b_lsm.8_5 == 0 niters.11_32 is correctly 1, but for b_lsm.8_5 == 255 it
gives
42 (i.e. (0x5fa & 0xff) / 6 + 1), while it should be 128, because the only
[0,255] values for which (v*6) & 0xff == 0 are 0 and 128.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/103063] [9/10/11/12 Regression] Wrong code while using -O3 since r7-2373-g69b806f6a60efcf1
2021-11-03 16:04 [Bug tree-optimization/103063] New: Wrong code while using -O3 stefansf at linux dot ibm.com
` (5 preceding siblings ...)
2022-01-19 17:42 ` jakub at gcc dot gnu.org
@ 2022-01-20 7:04 ` rguenth at gcc dot gnu.org
2022-01-24 13:16 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-20 7:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103063
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 #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'm going to look at this and the duplicates. There have been patches proposed
by Jiufu Guo but I need to thoroughly look and understand the code and the
failure mode to make sense of them (and most of them complicated the code
further).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug tree-optimization/103063] [9/10/11/12 Regression] Wrong code while using -O3 since r7-2373-g69b806f6a60efcf1
2021-11-03 16:04 [Bug tree-optimization/103063] New: Wrong code while using -O3 stefansf at linux dot ibm.com
` (6 preceding siblings ...)
2022-01-20 7:04 ` rguenth at gcc dot gnu.org
@ 2022-01-24 13:16 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-24 13:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103063
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|ASSIGNED |RESOLVED
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Duplicate btw.
*** This bug has been marked as a duplicate of bug 100499 ***
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-01-24 13:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 16:04 [Bug tree-optimization/103063] New: Wrong code while using -O3 stefansf at linux dot ibm.com
2021-11-03 17:23 ` [Bug tree-optimization/103063] " marxin at gcc dot gnu.org
2021-11-03 17:25 ` [Bug tree-optimization/103063] [9/10/11/12 Regression] Wrong code while using -O3 since r7-2373-g69b806f6a60efcf1 pinskia at gcc dot gnu.org
2021-11-04 9:02 ` rguenth at gcc dot gnu.org
2022-01-19 16:33 ` jakub at gcc dot gnu.org
2022-01-19 16:35 ` jakub at gcc dot gnu.org
2022-01-19 17:42 ` jakub at gcc dot gnu.org
2022-01-20 7:04 ` rguenth at gcc dot gnu.org
2022-01-24 13:16 ` 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).