[cfe-dev] Where are the methods, which handle the Element Region’s index, in Clang Static Analyzer?
Jordan Rose
jordan_rose at apple.com
Mon Nov 4 09:43:46 PST 2013
That's correct. Also, remember that symbolic values are immutable; when you do "ptr = ptr + 3", you're storing a new value into the same location. So the ElementRegion's index doesn't change, but 'ptr' now refers to a different ElementRegion.
Jordan
On Nov 4, 2013, at 4:33 , Arthur Yoo <phjy007 at gmail.com> wrote:
> It seems that evalBinOp() will do the related things. evalBinOp() also calls evalBinOpLN() and evalBinOpNN().
>
>
> 2013/10/30 Arthur Yoo <phjy007 at gmail.com>
> Hi all,
>
>
>
> ElementRegion has a field named Index (NoLoc) to record the index of that Array Element. We can also use pointer offset operation to calculate a new index and get the corresponding array element. For example:
>
> 1 void func() {
>
> 2 int arr[10];
>
> 3 int *ptr, *ptr2;
>
> 4 ptr = arr;
>
> 5 ptr = ptr + 3;
>
> 6 *ptr = 9;
>
> 7 ptr2 = ptr + 1;
>
> 8 *ptr2 = 10;
>
> 9 }
>
>
>
> Line 5 shows the pointer offset operation. I dumped the information of the pointee MemRegion referenced by ptr, the Static Analyzer gave me such result: element{arr,3 S32b,int}. That means after the pointer offset operation by line 5, the ptr’s pointee MemRegion became an ElementRegion of arr[], which index was 3 S32b. The line 7’s effect is same, it showed me element{arr,4 S32b,int}. Obviously, after the pointer offset operation, the ElementRegion’s Index will be changed. I want to know where are the methods that handle the Element Region’s index in pointer offset operation. Cause I want to find these methods and add some codes into them.
>
> Thanks a lot.
>
>
> --
> Best regards,
> Arthur Yoo
>
>
>
> --
> Best regards,
> 岳佳圆 | Yue Jiayuan | Arthur Yoo
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131104/ba164eab/attachment.html>
More information about the cfe-dev
mailing list