Issue 117300
Summary [LLVM] SIGSEGV with clang-trunk at -Os; Unexpected Behavior at -O1 vs Expected Infinite Loop at -O0 and gcc -O2
Labels new issue
Assignees
Reporter wangbo15
    The following code triggers a `SIGSEGV` when compiled with `clang-trunk` and `clang 19.1.0` using the `-Os` optimization level.
With `-O1`, the program exits with a return value of `64`. However, when compiled with `clang` `-O0` or `gcc` `-O2`, the program behaves as expected and enters an infinite loop.

Additionally, the behavior cases are also different on the `arm` backends.

```
#include <memory> 
unsigned long long a;
void b(unsigned long long *, int) {}
class {
public:
  short c[10];
} e;
int main() {
  for (size_t d;;)
    b(&a, e.c[d]);
}
```

Please see: https://godbolt.org/z/79fzqePEv


_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to