[Patch] Use uintptr_t instead of ptr comparisons in BumpPtrAllocator (Was: Re: [llvm] r215841 - BumpPtrAllocator: remove 'no slabs allocated yet' check)

Hans Wennborg hans at chromium.org
Sat Sep 6 21:34:35 PDT 2014


On Wed, Sep 3, 2014 at 10:51 AM, Chandler Carruth <chandlerc at google.com> wrote:
>
> On Wed, Sep 3, 2014 at 9:56 AM, Hans Wennborg <hans at chromium.org> wrote:
>>
>> On Wed, Sep 3, 2014 at 9:47 AM, Chandler Carruth <chandlerc at google.com>
>> wrote:
>> > As long as 'alignAddr' can move a pointer more than one past the end of
>> > the
>> > allocation, it doesn't really work IMO. But this is all such a
>> > technicality,
>> > I'm not sure how much continued hacking is worth here.
>>
>> I'm not sure I'm following here. alignAddr doesn't work with a
>> pointer, it's just rounding up a uintptr_t. Are you concerned about
>> comparing that uintptr_t to another uintptr_t?
>
>
> Ok, so it may be wrapping but isn't hitting UB. And the difference is
> defined and correct even if wrapped.... OK, sure.

I committed the patch based on the idea Duncan suggested in r217330.

 - Hans



More information about the llvm-commits mailing list