Issue 87229
Summary clang cannot detect any of the lifetime issue here but GCC can
Labels clang
Assignees
Reporter trcrsired
    https://learn.microsoft.com/en-us/cpp/sanitizers/error-stack-use-after-scope?view=msvc-170
```cpp
int *gp;
bool b = true;
int main() {
    if (b) {
        int x[5];
        gp = x+1;
    }
    return *gp;  // Boom!
}
```
clang (no warnings):
https://godbolt.org/z/qab3nP38f
gcc:
https://godbolt.org/z/Porf9Mejj
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to