<div dir="ltr"><div><div>If you want an exact "upper bound", you'll have to use something like SoftBound (<a href="http://acg.cis.upenn.edu/softbound">acg.cis.upenn.edu/softbound</a>), which keeps track of the size of each allocated region at runtime.<br>
</div><div><br></div></div>H.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Dec 16, 2013 at 4:26 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.</div>

<div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Sun, Dec 15, 2013 at 6:22 PM, 李永超 <span dir="ltr"><<a href="mailto:lyc364@gmail.com" target="_blank">lyc364@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div dir="ltr">Hi,<div>How can I obtain the upper bound of a pointer in the code? For example, I have </div><div>a pointer Ptr which points to a block of memory that is allocated by malloc, say,</div><div><br></div><div>
Ptr = malloc(size);</div>

<div><br></div><div><br></div><div>Then what should I do if I am going to get the upper bound of the memory block</div><div>that is pointed to by Ptr in the runtime?</div><div><br></div><div>Thanks,</div><div>Ben</div></div>


<br></div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>