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?)

llvm-svn: 113480
This commit is contained in:
Gabor Greif 2010-09-09 10:51:37 +00:00
parent 269f322110
commit 230ddf37af
3 changed files with 3 additions and 3 deletions

View File

@ -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<DefinedOrUnknownSVal>(ER->getIndex());
DefinedOrUnknownSVal Idx = cast<DefinedOrUnknownSVal>(ER->getIndex());
const GRState *state = C.getState();

View File

@ -193,7 +193,7 @@ const GRState *CStringChecker::CheckLocation(CheckerContext &C,
DefinedOrUnknownSVal Size = cast<DefinedOrUnknownSVal>(Extent);
// Get the index of the accessed element.
DefinedOrUnknownSVal &Idx = cast<DefinedOrUnknownSVal>(ER->getIndex());
DefinedOrUnknownSVal Idx = cast<DefinedOrUnknownSVal>(ER->getIndex());
const GRState *StInBound = state->AssumeInBound(Idx, Size, true);
const GRState *StOutBound = state->AssumeInBound(Idx, Size, false);

View File

@ -59,7 +59,7 @@ void ReturnPointerRangeChecker::PreVisitReturnStmt(CheckerContext &C,
if (!ER)
return;
DefinedOrUnknownSVal &Idx = cast<DefinedOrUnknownSVal>(ER->getIndex());
DefinedOrUnknownSVal Idx = cast<DefinedOrUnknownSVal>(ER->getIndex());
// FIXME: All of this out-of-bounds checking should eventually be refactored
// into a common place.