[cfe-commits] r72166 - in /cfe/trunk: lib/Analysis/RegionStore.cpp test/Analysis/array-struct.c
Zhongxing Xu
xuzhongxing at gmail.com
Wed May 20 02:19:13 PDT 2009
Author: zhongxingxu
Date: Wed May 20 04:18:48 2009
New Revision: 72166
URL: http://llvm.org/viewvc/llvm-project?rev=72166&view=rev
Log:
Treat AllocaRegion as SymbolicRegion in RegionStore::Retrieve().
Modified:
cfe/trunk/lib/Analysis/RegionStore.cpp
cfe/trunk/test/Analysis/array-struct.c
Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=72166&r1=72165&r2=72166&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
+++ cfe/trunk/lib/Analysis/RegionStore.cpp Wed May 20 04:18:48 2009
@@ -705,10 +705,13 @@
const MemRegion* MR = cast<loc::MemRegionVal>(L).getRegion();
- // We return unknown for symbolic region for now. This might be improved.
+ // FIXME: return symbolic value for these cases.
// Example:
// void f(int* p) { int x = *p; }
- if (isa<SymbolicRegion>(MR))
+ // char* p = alloca();
+ // read(p);
+ // c = *p;
+ if (isa<SymbolicRegion>(MR) || isa<AllocaRegion>(MR))
return UnknownVal();
// FIXME: Perhaps this method should just take a 'const MemRegion*' argument
Modified: cfe/trunk/test/Analysis/array-struct.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/array-struct.c?rev=72166&r1=72165&r2=72166&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/array-struct.c (original)
+++ cfe/trunk/test/Analysis/array-struct.c Wed May 20 04:18:48 2009
@@ -15,6 +15,7 @@
int data;
} STYPE;
+void g(char *p);
void g1(struct s* p);
// Array to pointer conversion. Array in the struct field.
@@ -62,6 +63,8 @@
void f6() {
char *p;
p = __builtin_alloca(10);
+ g(p);
+ char c = *p;
p[1] = 'a';
// Test if RegionStore::EvalBinOp converts the alloca region to element
// region.
@@ -98,7 +101,7 @@
// Retrieve the default value of element/field region.
void f11() {
struct s a;
- g(&a);
+ g1(&a);
if (a.data == 0) // no-warning
a.data = 1;
}
More information about the cfe-commits
mailing list