[cfe-commits] r74407 - in /cfe/trunk/lib/Analysis: BasicStore.cpp RegionStore.cpp

Zhongxing Xu xuzhongxing at gmail.com
Tue Jun 30 19:26:33 PDT 2009


int *p = 0x1111;
*p = 3;

But I haven't saw it in real code. So I didn't add a test case. Like
you suggest before, such cases should be handled in evalLocation for
null pointer check.

On Wed, Jul 1, 2009 at 3:47 AM, Ted Kremenek<kremenek at apple.com> wrote:
> Hi Zhongxing,
>
> Do you have a test case to accompany this patch that can go in the test
> suite?  It's not 100% clear to me how this gets triggered.
>
> Ted
>
> On Jun 28, 2009, at 3:16 AM, Zhongxing Xu wrote:
>
>> Author: zhongxingxu
>> Date: Sun Jun 28 05:16:11 2009
>> New Revision: 74407
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=74407&view=rev
>> Log:
>> Do not crash on binding concrete integer location.
>>
>> Modified:
>>   cfe/trunk/lib/Analysis/BasicStore.cpp
>>   cfe/trunk/lib/Analysis/RegionStore.cpp
>>
>> Modified: cfe/trunk/lib/Analysis/BasicStore.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BasicStore.cpp?rev=74407&r1=74406&r2=74407&view=diff
>>
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Analysis/BasicStore.cpp (original)
>> +++ cfe/trunk/lib/Analysis/BasicStore.cpp Sun Jun 28 05:16:11 2009
>> @@ -319,6 +319,9 @@
>> }
>>
>> Store BasicStoreManager::BindInternal(Store store, Loc loc, SVal V) {
>> +  if (isa<loc::ConcreteInt>(loc))
>> +    return store;
>> +
>>  const MemRegion* R = cast<loc::MemRegionVal>(loc).getRegion();
>>  ASTContext &C = StateMgr.getContext();
>>
>>
>> Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=74407&r1=74406&r2=74407&view=diff
>>
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
>> +++ cfe/trunk/lib/Analysis/RegionStore.cpp Sun Jun 28 05:16:11 2009
>> @@ -1074,6 +1074,9 @@
>> }
>>
>> const GRState *RegionStoreManager::Bind(const GRState *state, Loc L, SVal
>> V) {
>> +  if (isa<loc::ConcreteInt>(L))
>> +    return state;
>> +
>>  // If we get here, the location should be a region.
>>  const MemRegion* R = cast<loc::MemRegionVal>(L).getRegion();
>>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>




More information about the cfe-commits mailing list