public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111572] New: Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d
@ 2023-09-24 13:25 shaohua.li at inf dot ethz.ch
2023-09-24 16:49 ` [Bug tree-optimization/111572] " pinskia at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-09-24 13:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111572
Bug ID: 111572
Summary: Wrong code at -O2 on x86_64-linux-gnu since
r14-301-gf2d6beb7a4d
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: shaohua.li at inf dot ethz.ch
CC: jh at suse dot cz
Target Milestone: ---
gcc at -O2 produces the wrong code.
Bisected to r14-301-gf2d6beb7a4d
Compiler explorer: https://godbolt.org/z/reETd3ee4
$ cat a.c
int printf(const char *, ...);
int a, b = -8, e, f, h;
char c, d, g;
static int i(long k) {
e = 8;
for (; e; e = f) {
d = 6;
for (; d<7; d++) {
unsigned char j = 0;
for (; (unsigned char)(1 + k) + j <= 3; j++)
printf("%u\n", (unsigned char)(1 + k) + j);
}
for (; g; g++)
;
}
return 0;
}
int main() {
h = 26 & b;
i((short)(h - 65557) + 65535);
}
$
$ gcc -O0 a.c && ./a.out
3
$ gcc -O2 a.c && ./a.out
3
3
3
3
(Truncated)
$
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/111572] Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d
2023-09-24 13:25 [Bug tree-optimization/111572] New: Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d shaohua.li at inf dot ethz.ch
@ 2023-09-24 16:49 ` pinskia at gcc dot gnu.org
2023-09-24 16:49 ` [Bug tree-optimization/111572] [14 Regression] " pinskia at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-24 16:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111572
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
__builtin_printf ("%u\n", _79);
__builtin_unreachable ();
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/111572] [14 Regression] Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d
2023-09-24 13:25 [Bug tree-optimization/111572] New: Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d shaohua.li at inf dot ethz.ch
2023-09-24 16:49 ` [Bug tree-optimization/111572] " pinskia at gcc dot gnu.org
@ 2023-09-24 16:49 ` pinskia at gcc dot gnu.org
2023-09-24 16:51 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-24 16:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111572
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-09-24
Ever confirmed|0 |1
Target Milestone|--- |14.0
Status|UNCONFIRMED |NEW
Summary|Wrong code at -O2 on |[14 Regression] Wrong code
|x86_64-linux-gnu since |at -O2 on x86_64-linux-gnu
|r14-301-gf2d6beb7a4d |since r14-301-gf2d6beb7a4d
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/111572] [14 Regression] Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d
2023-09-24 13:25 [Bug tree-optimization/111572] New: Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d shaohua.li at inf dot ethz.ch
2023-09-24 16:49 ` [Bug tree-optimization/111572] " pinskia at gcc dot gnu.org
2023-09-24 16:49 ` [Bug tree-optimization/111572] [14 Regression] " pinskia at gcc dot gnu.org
@ 2023-09-24 16:51 ` pinskia at gcc dot gnu.org
2023-10-17 13:01 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-24 16:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111572
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Self contained testcase:
```
void gg(void)
{
static int t = 0;
if (t != 0) __builtin_abort();
t++;
}
int a, b = -8, e, f, h;
char c, d, g;
static int i(long k) {
e = 8;
for (; e; e = f) {
d = 6;
for (; d<7; d++) {
unsigned char j = 0;
for (; (unsigned char)(1 + k) + j <= 3; j++)
gg();
}
for (; g; g++)
;
}
return 0;
}
int main() {
h = 26 & b;
i((short)(h - 65557) + 65535);
}
```
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/111572] [14 Regression] Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d
2023-09-24 13:25 [Bug tree-optimization/111572] New: Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d shaohua.li at inf dot ethz.ch
` (2 preceding siblings ...)
2023-09-24 16:51 ` pinskia at gcc dot gnu.org
@ 2023-10-17 13:01 ` rguenth at gcc dot gnu.org
2023-11-05 21:28 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-17 13:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111572
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
CC| |hubicka at gcc dot gnu.org
Last reconfirmed|2023-09-24 00:00:00 |2023-10-17
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Re-confirmed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/111572] [14 Regression] Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d
2023-09-24 13:25 [Bug tree-optimization/111572] New: Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d shaohua.li at inf dot ethz.ch
` (3 preceding siblings ...)
2023-10-17 13:01 ` rguenth at gcc dot gnu.org
@ 2023-11-05 21:28 ` pinskia at gcc dot gnu.org
2023-11-06 16:14 ` jamborm at gcc dot gnu.org
2023-11-14 14:20 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-05 21:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111572
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |needs-bisection
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, this works on the trunk now. Would be a good idea to figure out what
"fixed" it.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/111572] [14 Regression] Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d
2023-09-24 13:25 [Bug tree-optimization/111572] New: Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d shaohua.li at inf dot ethz.ch
` (4 preceding siblings ...)
2023-11-05 21:28 ` pinskia at gcc dot gnu.org
@ 2023-11-06 16:14 ` jamborm at gcc dot gnu.org
2023-11-14 14:20 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2023-11-06 16:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111572
--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #5)
> Hmm, this works on the trunk now. Would be a good idea to figure out what
> "fixed" it.
If my simple test is correct, the error disappeared with
r14-4790-g9692309ed6b625 (Richi's: tree-optimization/111445 - simple_iv
simplification fault)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/111572] [14 Regression] Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d
2023-09-24 13:25 [Bug tree-optimization/111572] New: Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d shaohua.li at inf dot ethz.ch
` (5 preceding siblings ...)
2023-11-06 16:14 ` jamborm at gcc dot gnu.org
@ 2023-11-14 14:20 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-14 14:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111572
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|NEW |RESOLVED
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Yep, the testcase looks very related.
*** This bug has been marked as a duplicate of bug 111445 ***
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-11-14 14:20 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-24 13:25 [Bug tree-optimization/111572] New: Wrong code at -O2 on x86_64-linux-gnu since r14-301-gf2d6beb7a4d shaohua.li at inf dot ethz.ch
2023-09-24 16:49 ` [Bug tree-optimization/111572] " pinskia at gcc dot gnu.org
2023-09-24 16:49 ` [Bug tree-optimization/111572] [14 Regression] " pinskia at gcc dot gnu.org
2023-09-24 16:51 ` pinskia at gcc dot gnu.org
2023-10-17 13:01 ` rguenth at gcc dot gnu.org
2023-11-05 21:28 ` pinskia at gcc dot gnu.org
2023-11-06 16:14 ` jamborm at gcc dot gnu.org
2023-11-14 14:20 ` 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).