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

            Bug ID: 110337
           Summary: Wrong code at -O2/s on x86_64-linux-gnu
           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
  Target Milestone: ---

This seems to be a recent regression on GCC -O2/s

$ cat a.c
int printf(const char *, ...);
int a, e;
static short b = 3, f;
long c;
char d;
short g() {
  e = a;
  for (; a != 4;)
    return 39570 + d + b;
  return 0;
}
int main() {
  int h;
  f = g();
  int i = f;
  h = i < 0 ? i : i >> 14;
  c = b && h;
  printf("%d\n", (int)c);
}
$
$ gcc-tk -O0 a.c && ./a.out
1
$ gcc-tk -O2 a.c && ./a.out
-1
$
  • [Bug c/110337] New: Wrong code ... shaohua.li at inf dot ethz.ch via Gcc-bugs

Reply via email to