1 | // RUN: %clang_tysan -O0 %s -o %t && %run %t >%t.out 2>&1 |
2 | // RUN: FileCheck %s < %t.out |
3 | |
4 | // https://github.com/llvm/llvm-project/issues/62544 |
5 | |
6 | int printf(const char *, ...); |
7 | int a, b, c; |
8 | long d; |
9 | int main() { |
10 | short *e = &a; |
11 | int *f = &a; |
12 | *f = 0; |
13 | for (; b <= 9; b++) { |
14 | int **g = &f; |
15 | *f = d; |
16 | *g = &c; |
17 | } |
18 | |
19 | // CHECK: TypeSanitizer: type-aliasing-violation on address |
20 | // CHECK-NEXT: WRITE of size 2 at {{.+}} with type short accesses an existing object of type int |
21 | // CHECK-NEXT: in main {{.*/?}}violation-pr62544.c:22 |
22 | *e = 3; |
23 | printf("%d\n" , a); |
24 | } |
25 | |