public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971
@ 2023-09-12 7:11 shaohua.li at inf dot ethz.ch
2023-09-12 11:21 ` [Bug tree-optimization/111383] " xry111 at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-09-12 7:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111383
Bug ID: 111383
Summary: Wrong code at -Os on x86_64-linux-gnu since
r12-5138-ge82c382971
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: shaohua.li at inf dot ethz.ch
CC: aldyh at redhat dot com
Target Milestone: ---
gcc at -Os produced the wrong code.
Bisected to r12-5138-ge82c382971
Compiler explorer: https://godbolt.org/z/eYY31rn4d
$ cat a.c
int printf(const char *, ...);
int a, d = 1625015426;
char e;
short b;
short *f = &b, *g = &b;
void h(char *k) {
char c = *k;
for (; c;)
;
}
int main() {
*g = 25330;
int i, j;
i = 0;
for (; *f + d - 1625040257 < 7;)
;
for (; i < 4; i++) {
j = 0;
for (; (d - 1625015511) + (d - 1625015341) + j < 1; j++)
h(&e);
}
printf("%d\n", a);
}
$
$ gcc -O0 a.c && ./a.out
0
$ gcc -Os a.c && ./a.out
(Timeout)
$
$ gcc -fsanitize=address,undefined a.c && ./a.out
0
$
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/111383] Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971
2023-09-12 7:11 [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971 shaohua.li at inf dot ethz.ch
@ 2023-09-12 11:21 ` xry111 at gcc dot gnu.org
2023-09-12 12:37 ` [Bug tree-optimization/111383] [12/13/14 Regression] " rguenth at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-09-12 11:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111383
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |tree-optimization
CC| |xry111 at gcc dot gnu.org
--- Comment #1 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Please try to set the "component" field correctly.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/111383] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971
2023-09-12 7:11 [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971 shaohua.li at inf dot ethz.ch
2023-09-12 11:21 ` [Bug tree-optimization/111383] " xry111 at gcc dot gnu.org
@ 2023-09-12 12:37 ` rguenth at gcc dot gnu.org
2023-09-12 16:41 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-12 12:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111383
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Summary|Wrong code at -Os on |[12/13/14 Regression] Wrong
|x86_64-linux-gnu since |code at -Os on
|r12-5138-ge82c382971 |x86_64-linux-gnu since
| |r12-5138-ge82c382971
Target Milestone|--- |12.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/111383] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971
2023-09-12 7:11 [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971 shaohua.li at inf dot ethz.ch
2023-09-12 11:21 ` [Bug tree-optimization/111383] " xry111 at gcc dot gnu.org
2023-09-12 12:37 ` [Bug tree-optimization/111383] [12/13/14 Regression] " rguenth at gcc dot gnu.org
@ 2023-09-12 16:41 ` pinskia at gcc dot gnu.org
2023-09-12 16:44 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-12 16:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111383
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-09-12
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note -fno-ivopts causes the wrong code to go away ...
So it must be the IR that IV-opts produces causes the wrong code to happen.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/111383] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971
2023-09-12 7:11 [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971 shaohua.li at inf dot ethz.ch
` (2 preceding siblings ...)
2023-09-12 16:41 ` pinskia at gcc dot gnu.org
@ 2023-09-12 16:44 ` pinskia at gcc dot gnu.org
2023-09-12 16:46 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-12 16:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111383
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
-fwrapv also allows causes the correct code to happen.
The difference with/without -fwrapv is:
_7 = _6 + -1625040257;
if (_7 <= 6)
vs
if (_6 <= 1625040263)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/111383] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971
2023-09-12 7:11 [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971 shaohua.li at inf dot ethz.ch
` (3 preceding siblings ...)
2023-09-12 16:44 ` pinskia at gcc dot gnu.org
@ 2023-09-12 16:46 ` pinskia at gcc dot gnu.org
2023-09-17 20:12 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-12 16:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111383
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think iv-opts is changing:
(d - 1625015511) + (d - 1625015341)
into (2*d - N) which introduces an overflow ...
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/111383] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971
2023-09-12 7:11 [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971 shaohua.li at inf dot ethz.ch
` (4 preceding siblings ...)
2023-09-12 16:46 ` pinskia at gcc dot gnu.org
@ 2023-09-17 20:12 ` pinskia at gcc dot gnu.org
2023-10-20 13:50 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-17 20:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111383
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |110233
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
PR 110233 is almost likely a dup, where IV-OPTS is doing reassociation
incorrectly.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110233
[Bug 110233] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/111383] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971
2023-09-12 7:11 [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971 shaohua.li at inf dot ethz.ch
` (5 preceding siblings ...)
2023-09-17 20:12 ` pinskia at gcc dot gnu.org
@ 2023-10-20 13:50 ` rguenth at gcc dot gnu.org
2023-10-20 13:54 ` cvs-commit at gcc dot gnu.org
2023-10-20 13:57 ` rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-20 13:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111383
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|NEW |RESOLVED
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed by r14-4789-g44e7e4498c3cdc.
*** This bug has been marked as a duplicate of bug 110243 ***
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/111383] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971
2023-09-12 7:11 [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971 shaohua.li at inf dot ethz.ch
` (6 preceding siblings ...)
2023-10-20 13:50 ` rguenth at gcc dot gnu.org
@ 2023-10-20 13:54 ` cvs-commit at gcc dot gnu.org
2023-10-20 13:57 ` rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-20 13:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111383
--- Comment #7 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:a1fc2cc0a8a8b97dbc3dc6715fd4f384d9204845
commit r14-4791-ga1fc2cc0a8a8b97dbc3dc6715fd4f384d9204845
Author: Richard Biener <rguenther@suse.de>
Date: Fri Oct 20 15:52:09 2023 +0200
tree-optimization/111383 - testcase for fixed PR
PR tree-optimization/111383
PR tree-optimization/110243
gcc/testsuite/
* gcc.dg/torture/pr111383.c: New testcase.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/111383] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971
2023-09-12 7:11 [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971 shaohua.li at inf dot ethz.ch
` (7 preceding siblings ...)
2023-10-20 13:54 ` cvs-commit at gcc dot gnu.org
@ 2023-10-20 13:57 ` rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-20 13:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111383
Bug 111383 depends on bug 110233, which changed state.
Bug 110233 Summary: [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110233
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-10-20 13:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-12 7:11 [Bug c/111383] New: Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971 shaohua.li at inf dot ethz.ch
2023-09-12 11:21 ` [Bug tree-optimization/111383] " xry111 at gcc dot gnu.org
2023-09-12 12:37 ` [Bug tree-optimization/111383] [12/13/14 Regression] " rguenth at gcc dot gnu.org
2023-09-12 16:41 ` pinskia at gcc dot gnu.org
2023-09-12 16:44 ` pinskia at gcc dot gnu.org
2023-09-12 16:46 ` pinskia at gcc dot gnu.org
2023-09-17 20:12 ` pinskia at gcc dot gnu.org
2023-10-20 13:50 ` rguenth at gcc dot gnu.org
2023-10-20 13:54 ` cvs-commit at gcc dot gnu.org
2023-10-20 13:57 ` 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).