brintos

brintos / llvm-project-archived public Read only

0
0
Text · 510 B · b7956c0 Raw
22 lines · c
1// RUN: %clang_tysan -O0 %s -o %t && %run %t >%t.out 2>&12// RUN: FileCheck %s < %t.out3 4#include <stdio.h>5 6long foo(int *x, long *y) {7  *x = 0;8  *y = 1;9  // CHECK: ERROR: TypeSanitizer: type-aliasing-violation10  // CHECK: WRITE of size 8 at {{.*}} with type long accesses an existing object of type int11  // CHECK: {{#0 0x.* in foo .*int-long.c:}}[[@LINE-3]]12 13  return *x;14}15 16int main(void) {17  long l;18  printf("%ld\n", foo((int *)&l, &l));19}20 21// CHECK-NOT: ERROR: TypeSanitizer: type-aliasing-violation22