1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-store=region %s -verify
2 // expected-no-diagnostics
4 //===-- unions-region.m ---------------------------------------------------===//
6 // This file tests the analyzer's reasoning about unions.
8 //===----------------------------------------------------------------------===//
10 // [testA] When using RegionStore, this test case previously had a
11 // false positive of a 'pass-by-value argument is uninitialized'
12 // warning at the call to 'testA_aux' and 'testA_aux_2'.
18 float testA(float f) {
19 int testA_aux(unsigned x);
20 int testA_aux_2(union u_testA z);
25 if (testA_aux(swap.i)) // no-warning
26 swap.i = ((swap.i & 0xffff0000) >> 16) | ((swap.i & 0x0000fffff) << 16);
28 testA_aux_2(swap); // no-warning
33 // [testB] When using RegionStore, this test case previously had a
34 // false positive of a 'pass-by-value argument is uninitialized'
35 // warning at the call to 'testB_aux'.
37 void testB_aux(short z);
38 union { short x[2]; unsigned y; } val;
40 testB_aux(val.x[1]); // no-warning