[cfe-commits] r110020 - in /cfe/trunk: include/clang/Checker/PathSensitive/MemRegion.h lib/Checker/FlatStore.cpp lib/Checker/MemRegion.cpp lib/Checker/RegionStore.cpp lib/Checker/SimpleSValuator.cpp lib/Checker/Store.cpp test/Analysis/flat-store.

Zhongxing Xu xuzhongxing at gmail.com
Mon Aug 2 21:48:31 PDT 2010


On Tue, Aug 3, 2010 at 9:39 AM, Jordy Rose <jediknil at belkadan.com> wrote:
>
> On Tue, 3 Aug 2010 09:25:08 +0800, Zhongxing Xu <xuzhongxing at gmail.com>
> wrote:
>> On Tue, Aug 3, 2010 at 12:12 AM, Ted Kremenek <kremenek at apple.com>
> wrote:
>>> On Aug 1, 2010, at 9:56 PM, Zhongxing Xu <xuzhongxing at gmail.com> wrote:
>>>
>>>> +/// Represent a region's offset within the top level base region.
>>>> +class RegionOffset {
>>>> +  /// The base region.
>>>> +  const MemRegion *R;
>>>> +
>>>> +  /// The bit offset within the base region. It shouldn't be
> negative.
>>>> +  uint64_t Offset;
>>>
>>> Why is the offset guaranteed to be non-negative?  Can't we construct
>>> ElementRegions with a negative index?
>>>
>>
>> Because the offset is within the toplevel object region and used for
>> representing region bindings, binding to a negative index is illegal.
>
> Not if the top-level region is a symbolic region representing an argument
> pointer. This is perfectly valid, if a little cringe-worthy:
>
> void foo (const int *a) {
>  int prev = a[-1];
> }
>

This makes sense. I'll change the offset into a signed int.




More information about the cfe-commits mailing list