[LLVMdev] How can I obtain upper bound of a pointer?

Henrique Santos henrique.nazare.santos at gmail.com
Mon Dec 16 05:34:22 PST 2013


If you want an exact "upper bound", you'll have to use something like
SoftBound (acg.cis.upenn.edu/softbound), which keeps track of the size of
each allocated region at runtime.

H.


On Mon, Dec 16, 2013 at 4:26 AM, David Blaikie <dblaikie at gmail.com> wrote:

> This is rather off-topic for LLVM, it's a C programming question and the C
> answer is: you can't. C doesn't expose any way to find the upper limit of
> 'Ptr' you just have to keep track of what size you used yourself.
>
>
> On Sun, Dec 15, 2013 at 6:22 PM, 李永超 <lyc364 at gmail.com> wrote:
>
>> Hi,
>> How can I obtain the upper bound of a pointer in the code? For example, I
>> have
>> a pointer Ptr which points to a block of memory that is allocated by
>> malloc, say,
>>
>> Ptr = malloc(size);
>>
>>
>> Then what should I do if I am going to get the upper bound of the memory
>> block
>> that is pointed to by Ptr in the runtime?
>>
>> Thanks,
>> Ben
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131216/ed56ef87/attachment.html>


More information about the llvm-dev mailing list