Issue |
122954
|
Summary |
[TySan] False positive with global structs
|
Labels |
new issue
|
Assignees |
|
Reporter |
TheLastRar
|
This was previously reported in the discourse, since TySan has now been merged I'm reposting it on Github
This is the reduced version from [gbMattN](https://discourse.llvm.org/t/reviving-typesanitizer-a-sanitizer-to-catch-type-based-aliasing-violations/66092/22), the original report used a `std::array<float,2>`
Tysan reports a type violation when arr is in the global scope https://godbolt.org/z/TxeaaY5cc
```C
#include <stdio.h>
struct array_type{
int inner[1];
};
struct array_type arr;
int main() {
arr.inner[0] = 5;
return 0;
}
```
TySan currently reports
```
==1==ERROR: TypeSanitizer: type-aliasing-violation on address 0x5d14c0846c5c (pc 0x5d14bfeefb4b bp 0x7ffd3e06b7a0 sp 0x7ffd3e06b730 tid 1)
WRITE of size 4 at 0x5d14c0846c5c with type int accesses an existing object of type array_type
#0 0x5d14bfeefb4a (/app/output.s+0x2ab4a)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs