<div dir="ltr">
















<p class="MsoNormal">Hi all,</p><p class="MsoNormal"><br></p>

<p class="MsoNormal">ElementRegion has a field named <i>Index (NoLoc) </i>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:</p>

<p class="MsoNormal">1 void func() {</p>

<p class="MsoNormal">2    int arr[10];</p>

<p class="MsoNormal">3     int *ptr, *ptr2;</p>

<p class="MsoNormal">4     ptr = arr;</p>

<p class="MsoNormal">5     ptr = ptr + 3;</p>

<p class="MsoNormal">6     *ptr = 9;</p>

<p class="MsoNormal">7     ptr2 = ptr + 1;</p>

<p class="MsoNormal">8     *ptr2 = 10;</p>

<p class="MsoNormal">9 }</p><p class="MsoNormal"><br></p>

<p class="MsoNormal">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 <i>3 S32b</i>. 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. </p><p class="MsoNormal">Thanks a lot.</p>

<div><br></div>-- <br><div dir="ltr"><font color="#444444">Best regards,</font><div><font color="#444444">Arthur Yoo</font></div></div>
</div>