Issue 208651
Summary [compiler-rt][tysan] False positives with vtable pointer initialization
Labels new issue
Assignees
Reporter onurcan-isler-oss
    # static or global variables with `vtable`
#### Flags: `-stdlib=libc++ -fsanitize=type -O0`
#### Compiler: x86-64 clang 22.1.0
#### Link: https://godbolt.org/z/1f9na6h36
#### Code: 
```.cpp
class A {
public:
    virtual ~A() = default;
    char byte;
};

static A a;

int main() {}
```
#### Logs:
```
==1==ERROR: TypeSanitizer: type-aliasing-violation on address 0x5f724336cee8 (pc 0x5f7242a12067 bp 0x7ffeec53b2a0 sp 0x7ffeec53b230 tid 1)
WRITE of size 8 at 0x5f724336cee8 with type vtable pointer accesses an existing object of type A
    #0 0x5f7242a12066  (/app/output.s+0x36066)
```
#### Explanation:
Likely a static lifetime + virtual object initialization. Removal of `byte` variable does not reproduce.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to