From 89b06584402a38933e108b66ded3a168cd492dff Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Thu, 9 Sep 2010 10:51:37 +0000 Subject: [PATCH] do not bind temporaries to non-const references this fixes all analyser test failures in my gcc34-based environment how the cast result could bind to the non-const ref is somewhat mysterious and remains to be investigated; to avoid similar miscompilations (by gcc34 only?) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113480 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Checker/ArrayBoundChecker.cpp | 2 +- lib/Checker/CStringChecker.cpp | 2 +- lib/Checker/ReturnPointerRangeChecker.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Checker/ArrayBoundChecker.cpp b/lib/Checker/ArrayBoundChecker.cpp index 98345bd703..cf2a2fcf62 100644 --- a/lib/Checker/ArrayBoundChecker.cpp +++ b/lib/Checker/ArrayBoundChecker.cpp @@ -51,7 +51,7 @@ void ArrayBoundChecker::VisitLocation(CheckerContext &C, const Stmt *S, SVal l){ return; // Get the index of the accessed element. - DefinedOrUnknownSVal &Idx = cast(ER->getIndex()); + DefinedOrUnknownSVal Idx = cast(ER->getIndex()); const GRState *state = C.getState(); diff --git a/lib/Checker/CStringChecker.cpp b/lib/Checker/CStringChecker.cpp index 9ea572f90d..d61fdd437d 100644 --- a/lib/Checker/CStringChecker.cpp +++ b/lib/Checker/CStringChecker.cpp @@ -193,7 +193,7 @@ const GRState *CStringChecker::CheckLocation(CheckerContext &C, DefinedOrUnknownSVal Size = cast(Extent); // Get the index of the accessed element. - DefinedOrUnknownSVal &Idx = cast(ER->getIndex()); + DefinedOrUnknownSVal Idx = cast(ER->getIndex()); const GRState *StInBound = state->AssumeInBound(Idx, Size, true); const GRState *StOutBound = state->AssumeInBound(Idx, Size, false); diff --git a/lib/Checker/ReturnPointerRangeChecker.cpp b/lib/Checker/ReturnPointerRangeChecker.cpp index a9eb5ce1a7..0e7a5cf9d1 100644 --- a/lib/Checker/ReturnPointerRangeChecker.cpp +++ b/lib/Checker/ReturnPointerRangeChecker.cpp @@ -59,7 +59,7 @@ void ReturnPointerRangeChecker::PreVisitReturnStmt(CheckerContext &C, if (!ER) return; - DefinedOrUnknownSVal &Idx = cast(ER->getIndex()); + DefinedOrUnknownSVal Idx = cast(ER->getIndex()); // FIXME: All of this out-of-bounds checking should eventually be refactored // into a common place. -- 2.40.0