Open
Description
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, 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
#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)