diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-03-22 20:11:00 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-03-22 20:11:00 +0000 |
commit | 5fb5c6afbb331b87c638fad42f5b37ed697e5580 (patch) | |
tree | 5913c8d778461b7e397c3dc41ba0f4763f30f16f | |
parent | c68ab77068d1aef6c31f18e941b79201be0f71f3 (diff) |
Changed merge operation for uninitialized values analysis to "intersect" (previous union).
The effect is that if a variable is uninitialized along a branch (but initialized along another), at merge points it is considered uninitialized. Previously we had the opposite behavior. The new behavior is more conservative, and more in line with gcc's behavior.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48689 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Analysis/UninitializedValues.cpp | 2 | ||||
-rw-r--r-- | test/Analysis/uninit-vals.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/Analysis/UninitializedValues.cpp b/lib/Analysis/UninitializedValues.cpp index 25a5ecb483..3edf04ddb6 100644 --- a/lib/Analysis/UninitializedValues.cpp +++ b/lib/Analysis/UninitializedValues.cpp @@ -223,7 +223,7 @@ bool TransferFuncs::BlockStmt_VisitExpr(Expr* E) { //===----------------------------------------------------------------------===// namespace { - typedef ExprDeclBitVector_Types::Union Merge; + typedef ExprDeclBitVector_Types::Intersect Merge; typedef DataflowSolver<UninitializedValues,TransferFuncs,Merge> Solver; } diff --git a/test/Analysis/uninit-vals.c b/test/Analysis/uninit-vals.c index 041c946fb0..fa6d0fc481 100644 --- a/test/Analysis/uninit-vals.c +++ b/test/Analysis/uninit-vals.c @@ -20,7 +20,7 @@ int f3(int x) { int f4(int x) { int y; if (x) y = 1; - return y; // no-warning + return y; // expected-warning {{use of uninitialized variable}} } int f5() { |