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

            Bug ID: 111007
           Summary: [14 Regression] Wrong code at -O0 on
                    x86_64-pc-linux-gnu
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jwzeng at nuaa dot edu.cn
  Target Milestone: ---

gcc at -O0 produces the wrong code.

$ cat bug.c
int printf(const char *, ...);
unsigned int a = 1111847502U;
unsigned int b = 1864610367U;
#define max(a, b) ((a) > (b) ? (a) : (b))
int main() {
    a = max(b && 1071974078U, 0 ^ (!b));
    printf("%u\n", a);
}
$
$ gcc-trunk bug.c; ./a.out
4294967295
$ gcc-13 bug.c; ./a.out
1
$ gcc-9 bug.c; ./a.out
1
$
$ gcc-trunk --version
Target: x86_64-pc-linux-gnu
gcc (GCC) 14.0.0 20230811 (experimental) [master r14-3137-g4271b7422f]
$ gcc-13 --version
gcc (GCC) 13.1.0
$ gcc-9 --version
gcc-9 (Ubuntu 9.4.0-1ubuntu1~16.04) 9.4.0

Reply via email to