annotate clang/test/Analysis/uninit-vals-union.c @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core.builtin -analyzer-store=region -verify -Wno-unused %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 typedef union {
anatofuz
parents:
diff changeset
4 int y;
anatofuz
parents:
diff changeset
5 } U;
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 typedef struct { int x; } A;
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 void foo() {
anatofuz
parents:
diff changeset
10 U u = {};
anatofuz
parents:
diff changeset
11 A *a = &u; // expected-warning{{incompatible pointer types}}
anatofuz
parents:
diff changeset
12 a->x; // no-crash
anatofuz
parents:
diff changeset
13 }