Issue 124413
Summary ASAN fails to catch UAF on compound literal
Labels new issue
Assignees
Reporter Alcaro
    ```c
#include <stdio.h>

int main(void) {
 int *xs[5] = {0};

    for (int i = 0; i < 5; ++i) {
        xs[i] = &(int){42};
    }

    for (int i = 0; i < 5; ++i) {
        printf("%p = %d\n", xs[i], *xs[i]);
    }
}
```
-fsanitize=address

GCC complains, Clang doesn't. https://godbolt.org/z/Phqh9fGsj

(Not mine, user garciat posted it on godbolt discord and asked if it's UB.)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to