[cfe-commits] r48469 - /cfe/trunk/lib/Analysis/GRExprEngine.cpp
Ted Kremenek
kremenek at apple.com
Mon Mar 17 15:17:56 PDT 2008
Author: kremenek
Date: Mon Mar 17 17:17:56 2008
New Revision: 48469
URL: http://llvm.org/viewvc/llvm-project?rev=48469&view=rev
Log:
Fix integer overflow bug when processing switch statements.
Modified:
cfe/trunk/lib/Analysis/GRExprEngine.cpp
Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=48469&r1=48468&r2=48469&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Mon Mar 17 17:17:56 2008
@@ -288,13 +288,14 @@
assert (V1 <= V2);
}
- else V2 = V1;
+ else
+ V2 = V1;
// FIXME: Eventually we should replace the logic below with a range
// comparison, rather than concretize the values within the range.
// This should be easy once we have "ranges" for NonLVals.
- do {
+ do {
nonlval::ConcreteInt CaseVal(BasicVals.getValue(V1));
RVal Res = EvalBinOp(BinaryOperator::EQ, CondV, CaseVal);
@@ -323,10 +324,14 @@
if (isFeasible)
DefaultSt = StNew;
- // Concretize the next value in the range.
+ // Concretize the next value in the range.
+ if (V1 == V2)
+ break;
+
++V1;
+ assert (V1 < V2);
- } while (V1 < V2);
+ } while (true);
}
// If we reach here, than we know that the default branch is
More information about the cfe-commits
mailing list