forked from OSchip/llvm-project
Relax RegionStore to allow loads from CodeTextRegions. Apparently you can actually write code that does this. This seems worthy of a checker, but the StoreManager should handle the memory abstraction without crashing. Fixes PR 11450.
llvm-svn: 145424
This commit is contained in:
parent
b61cc44265
commit
cfe4ff9725
|
|
@ -882,7 +882,9 @@ SVal RegionStoreManager::Retrieve(Store store, Loc L, QualType T) {
|
|||
|
||||
const MemRegion *MR = cast<loc::MemRegionVal>(L).getRegion();
|
||||
|
||||
if (isa<AllocaRegion>(MR) || isa<SymbolicRegion>(MR)) {
|
||||
if (isa<AllocaRegion>(MR) ||
|
||||
isa<SymbolicRegion>(MR) ||
|
||||
isa<CodeTextRegion>(MR)) {
|
||||
if (T.isNull()) {
|
||||
const SymbolicRegion *SR = cast<SymbolicRegion>(MR);
|
||||
T = SR->getSymbol()->getType(Ctx);
|
||||
|
|
@ -890,10 +892,6 @@ SVal RegionStoreManager::Retrieve(Store store, Loc L, QualType T) {
|
|||
MR = GetElementZeroRegion(MR, T);
|
||||
}
|
||||
|
||||
if (isa<CodeTextRegion>(MR)) {
|
||||
llvm_unreachable("Why load from a code text region?");
|
||||
}
|
||||
|
||||
// FIXME: Perhaps this method should just take a 'const MemRegion*' argument
|
||||
// instead of 'Loc', and have the other Loc cases handled at a higher level.
|
||||
const TypedValueRegion *R = cast<TypedValueRegion>(MR);
|
||||
|
|
|
|||
|
|
@ -484,3 +484,11 @@ void PR11249()
|
|||
*p = 0xDEADBEEF; // no-warning
|
||||
}
|
||||
|
||||
// Handle doing a load from the memory associated with the code for
|
||||
// a function.
|
||||
extern double nan( const char * );
|
||||
double PR11450() {
|
||||
double NaN = *(double*) nan;
|
||||
return NaN;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue