[llvm] [llvm] Fix __builtin_object_size interaction between Negative Offset … (PR #111827)
Harald van Dijk via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 12 15:51:26 PDT 2024
hvdijk wrote:
Thanks for pointing me to `Type = 3` just not being generally supported, and I agree with your explanation of why the caching should be a non-issue.
Unfortunately, more testing reveals that since this only works when the constant offset is known, it does not yet handle all cases, there are cases where the constant offset is not visible. With a modification to my test, I still get a false UBSan positive.
```c++
int x;
int main(void) {
int array[4] = {0};
int *ptr;
if (x) {
ptr = 0;
} else {
ptr = array + 2;
}
if (x) {
ptr = 0;
} else {
ptr = ptr + 2;
}
return ptr[-1];
}
```
https://github.com/llvm/llvm-project/pull/111827
More information about the llvm-commits
mailing list