Issue 98007
Summary [clang] wrong code at -O0
Labels clang
Assignees
Reporter bi6c
    ```c
#include<stdint.h>
#include<stdio.h>

static long __undefined;

static int8_t g_3[1] = {0x03L};
static int32_t g_5 = 0x4B283066L;

int main (int argc, char* argv[])
{
 int8_t * const l_2 = &g_3[0];
    g_5 |= (l_2 != &g_3[0]);
 printf("%d", g_5);
    return 0;
}
```
Hello, we are using clang to compile the above code in Ubuntu 22.04.3 LTS.
We found a case that there are discrepancies when compiling with llvmorg-14.0.6 at optimization levels -O0.
```
$ ../compiler-builds/llvmorg-14.0.6_build/bin/clang -fsanitize=undefined -fsanitize=address --rtlib=compiler-rt -g -lgcc_s -I/home/csmith/include/csmith-2.3.0 -O0 testcase.c -o exec

$ timeout 1s ./exec 2>exec.err
1260925031

$ ../compiler-builds/llvmorg-13.0.1_build/bin/clang -fsanitize=undefined -fsanitize=address --rtlib=compiler-rt -g -lgcc_s -I/home/csmith/include/csmith-2.3.0 -O0 testcase.c -o exec

$ timeout 1s ./exec 2>exec.err
1260925030
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to