public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111365] New: Wrong code at -O3 since r13-1268-g8c99e307b20
@ 2023-09-11  7:25 shaohua.li at inf dot ethz.ch
  2023-09-11  8:21 ` [Bug tree-optimization/111365] " xry111 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-11  7:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111365
           Summary: Wrong code at -O3 since r13-1268-g8c99e307b20
           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 -O3 produced the wrong code.

Bisected to r13-1268-g8c99e307b20

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

$ cat a.c
int printf(const char *, ...);
int a, c, d, e = -1233286202, f = -1233286202;
short b, g, j;
int k(int l) {
  if (l <= 0 || &c + l > &d)
    return -1;
  return 0;
}
int m(int l) {
  int h = k(l);
  return h;
}
int main() {
  int i = 0;
  for (;
       (m(f + 1233286202) + e + (f + 1233286202) + 1233220671) + 65532U + i <
9;
       i++)
    g = 6;
  printf("%d\n", g);
}
$
$ gcc -O0 a.c && ./a.out
6
$ gcc -O3 a.c && ./a.out
0
$ gcc -fsanitize=address,undefined a.c && ./a.out
6
$

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-11  7:25 [Bug c/111365] New: Wrong code at -O3 since r13-1268-g8c99e307b20 shaohua.li at inf dot ethz.ch
2023-09-11  8:21 ` [Bug tree-optimization/111365] " xry111 at gcc dot gnu.org
2023-09-11  8:37 ` xry111 at gcc dot gnu.org
2023-09-11  8:41 ` xry111 at gcc dot gnu.org
2023-09-11  8:43 ` xry111 at gcc dot gnu.org
2023-09-17 20:08 ` [Bug tree-optimization/111365] [13/14 Regression] " pinskia at gcc dot gnu.org
2023-09-17 20:08 ` pinskia at gcc dot gnu.org
2023-10-20 13:58 ` 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).