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

            Bug ID: 111000
           Summary: Wrong code at -O3 on x86_64-linux-gnu since
                    r14-2944-g3d48c11ad08
           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: ---

gcc at -O3 produces the wrong code.

Bisected to r14-2944-g3d48c11ad08

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

$ cat a.c
int printf(const char *, ...);
long a = 68;
int b, d, e;
int main() {
  for (; d <= 6; d++) {
    b = 0;
    for (; b <= 6; b++) {
      int c = a;
      e = c >= 32 || d > 647 >> c ? d : 0;
    }
  }
  printf("%d\n", e);
}
$
$ gcc -O0 a.c &&./a.out
6
$ gcc -O3 a.c && ./a.out
4
$

Reply via email to