25 lines · c
1// RUN: %clang_tysan -O0 %s -o %t && %run %t >%t.out 2>&12// RUN: FileCheck %s < %t.out3 4// https://github.com/llvm/llvm-project/issues/625445 6int printf(const char *, ...);7int a, b, c;8long d;9int main() {10 short *e = (short *)&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 address20 // CHECK-NEXT: WRITE of size 2 at {{.+}} with type short accesses an existing object of type int21 // CHECK-NEXT: in main {{.*/?}}violation-pr62544.c:2222 *e = 3;23 printf("%d\n", a);24}25