xref: /llvm-project/compiler-rt/test/tysan/union-wr-wr.c (revision 641fbf1524338c86c952ebb1ec8d2b497ada3cef)
1 // RUN: %clang_tysan -O0 %s -o %t && %run %t >%t.out 2>&1
2 // RUN: FileCheck %s < %t.out
3 
4 #include <stdio.h>
5 
6 // CHECK-NOT: ERROR: TypeSanitizer: type-aliasing-violation
7 
8 int main() {
9   union {
10     int i;
11     short s;
12   } u;
13 
14   u.i = 42;
15   u.s = 1;
16 
17   printf("%d\n", u.i);
18 }
19