Issue 55661
Summary ASan misses a stack-bufferoverflow at -O2 and above (since clang12).
Labels new issue
Assignees
Reporter shao-hua-li
    For the following code, `clang -O2 -fsanitize=address` missed the buffer-overflow in line 4. I checked the assembly code, since the array `a` is volatile, `a[i]=1` would not be optimized aways by the optimizer. So this is probably an Asan issue. This issue only existed since clang12.*.

https://godbolt.org/z/1x4vdshhh
 
```c
int foo(int j) {
  volatile int a[2];
  for (int i = 0; i < j; i++)
        a[i] = 1;
}
int main() {
  foo(3);
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to