public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111336] New: Wrong code at -O2/3 since r14-2472-g14b10ff30ad
@ 2023-09-08  7:03 shaohua.li at inf dot ethz.ch
  2023-09-08  7:35 ` [Bug tree-optimization/111336] [14 Regression] " xry111 at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-09-08  7:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111336
           Summary: Wrong code at -O2/3 since r14-2472-g14b10ff30ad
           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: hubicka at gcc dot gnu.org
  Target Milestone: ---

gcc at -O2/3 produced the wrong code on the following testcase.

Bisected to r14-2472-g14b10ff30ad

Compiler explorer: https://godbolt.org/z/njdcv5aK8

$ cat a.c
int printf(const char *, ...);
int a, b;
long c = 3521733542;
int d[2];
int e(int f, int g) {
  if (f == 0)
    return 0;
  if (f > 200)
    return 0;
  if (g)
    return 5 * f;
  return 0;
}
int main() {
  int h = 0;
  for (; e((int)c + 773233762, c + 60) + 773163185 + h < 2; h++)
    d[h] = b;
  printf("%X\n", a);
}
$
$ gcc -O0 a.c && ./a.out
0
$ gcc -O2 a.c && ./a.out
Segmentation fault
$

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

end of thread, other threads:[~2023-10-20 13:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08  7:03 [Bug c/111336] New: Wrong code at -O2/3 since r14-2472-g14b10ff30ad shaohua.li at inf dot ethz.ch
2023-09-08  7:35 ` [Bug tree-optimization/111336] [14 Regression] " xry111 at gcc dot gnu.org
2023-09-08 12:31 ` shaohua.li at inf dot ethz.ch
2023-09-08 17:04 ` pinskia at gcc dot gnu.org
2023-09-08 17:12 ` xry111 at gcc dot gnu.org
2023-09-08 17:15 ` pinskia at gcc dot gnu.org
2023-09-08 17:16 ` pinskia at gcc dot gnu.org
2023-10-17 12:53 ` rguenth at gcc dot gnu.org
2023-10-17 14:02 ` rguenth at gcc dot gnu.org
2023-10-20 13:15 ` cvs-commit at gcc dot gnu.org
2023-10-20 13:17 ` 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).