1 // RUN: %clang_tysan -O0 %s -o %t && %run %t >%t.out 2>&1 2 // RUN: FileCheck %s < %t.out 3 4 float *P; 5 void zero_array() { 6 int i; 7 for (i = 0; i < 1; ++i) 8 P[i] = 0.0f; 9 // CHECK: ERROR: TypeSanitizer: type-aliasing-violation 10 // CHECK: WRITE of size 4 at {{.*}} with type float accesses an existing object of type p1 float 11 // CHECK: {{#0 0x.* in zero_array .*ptr-float.c:}}[[@LINE-3]] 12 } 13 14 int main() { 15 P = (float *)&P; 16 zero_array(); 17 } 18 19 // CHECK-NOT: ERROR: TypeSanitizer: type-aliasing-violation 20