public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111331] New: Wrong code at -O1 on x86_64-linux-gnu since
@ 2023-09-07 20:35 shaohua.li at inf dot ethz.ch
  2023-09-07 20:50 ` [Bug tree-optimization/111331] " pinskia at gcc dot gnu.org
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-09-07 20:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111331

            Bug ID: 111331
           Summary: Wrong code at -O1 on x86_64-linux-gnu since
           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: rguenth at gcc dot gnu.org
  Target Milestone: ---

gcc at -O1 produced the wrong code.

Bisected to r9-3606-g1cab645d3e3

Compiler explorer: https://godbolt.org/z/5YEv44PTa

$ cat a.c
int printf(const char *, ...);
int a;
int b;
int c(int d, int e, int f) {
  if (d < e)
    return e;
  if (d > f)
    return f;
  return d;
}
int main() {
  int g = -1;
  a = c(b + 30, 29, g + 29);
  printf("%d\n", a);
}
$
$ gcc -O0 a.c && ./a.out
28
$ gcc -O1 a.c && ./a.out
29
$

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-05-08 16:30 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-07 20:35 [Bug c/111331] New: Wrong code at -O1 on x86_64-linux-gnu since shaohua.li at inf dot ethz.ch
2023-09-07 20:50 ` [Bug tree-optimization/111331] " pinskia at gcc dot gnu.org
2023-09-07 21:05 ` pinskia at gcc dot gnu.org
2023-09-07 21:11 ` [Bug tree-optimization/111331] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-09-07 21:32 ` pinskia at gcc dot gnu.org
2023-09-07 21:44 ` pinskia at gcc dot gnu.org
2023-09-07 23:19 ` pinskia at gcc dot gnu.org
2023-09-08  0:17 ` pinskia at gcc dot gnu.org
2023-09-08  2:22 ` pinskia at gcc dot gnu.org
2023-09-08  5:00 ` pinskia at gcc dot gnu.org
2023-09-08  5:03 ` pinskia at gcc dot gnu.org
2023-09-08  5:24 ` pinskia at gcc dot gnu.org
2023-09-08 12:44 ` pinskia at gcc dot gnu.org
2023-09-10 15:48 ` cvs-commit at gcc dot gnu.org
2023-09-10 15:49 ` [Bug tree-optimization/111331] [11/12/13 " pinskia at gcc dot gnu.org
2023-09-12 11:27 ` rguenth at gcc dot gnu.org
2023-10-01 20:23 ` cvs-commit at gcc dot gnu.org
2023-10-01 20:25 ` [Bug tree-optimization/111331] [11/12 " pinskia at gcc dot gnu.org
2024-03-18 21:57 ` pinskia at gcc dot gnu.org
2024-05-08 16:28 ` cvs-commit at gcc dot gnu.org
2024-05-08 16:29 ` cvs-commit at gcc dot gnu.org
2024-05-08 16:30 ` pinskia 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).