diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp --- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -2497,8 +2497,8 @@ return bindAggregate(B, R, Init); } - if (Init.isUnknown()) - return bindAggregate(B, R, UnknownVal()); + if (!isa(Init)) + return bindAggregate(B, R, Init); // Remaining case: explicit compound values. const nonloc::CompoundVal& CV = Init.castAs(); diff --git a/clang/test/Analysis/region-store.c b/clang/test/Analysis/region-store.c --- a/clang/test/Analysis/region-store.c +++ b/clang/test/Analysis/region-store.c @@ -1,4 +1,6 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix,debug.ExprInspection \ +// RUN: -verify -analyzer-config eagerly-assume=false -std=c99 %s \ +// RUN: -Wno-implicit-function-declaration int printf(const char *restrict,...); @@ -54,3 +56,13 @@ clang_analyzer_eval(values[0] == 4);// expected-warning {{UNKNOWN}} } } + +int buffer[10]; +void b(); // expected-warning {{a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a subsequent definition}} +void top() { + // expected-warning@+1 {{passing arguments to 'b' without a prototype is deprecated in all versions of C and is not supported in C2x}} + b(&buffer); +} +void b(int *c) { // expected-note {{conflicting prototype is here}} + *c = 42; // no-crash +}