Index: cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp +++ cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -1674,7 +1674,8 @@ // Lazy bindings are usually handled through getExistingLazyBinding(). // We should unify these two code paths at some point. - if (val.getAs()) + if (val.getAs() || + val.getAs()) return val; llvm_unreachable("Unknown default value"); Index: cfe/trunk/test/Analysis/uninit-vals-union.c =================================================================== --- cfe/trunk/test/Analysis/uninit-vals-union.c +++ cfe/trunk/test/Analysis/uninit-vals-union.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core.builtin -analyzer-store=region -verify -Wno-unused %s + +typedef union { + int y; +} U; + +typedef struct { int x; } A; + +void foo() { + U u = {}; + A *a = &u; // expected-warning{{incompatible pointer types}} + a->x; // no-crash +}