<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 21, 2021 at 9:08 PM John McCall via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>




<div>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">On 21 Jun 2021, at 2:15, Juneyoung Lee wrote:</p>

</div><div style="white-space:normal"><blockquote style="border-left:2px solid rgb(57,131,196);color:rgb(57,131,196);margin:0px 0px 5px;padding-left:5px"><p dir="auto">
actually have semantics for pointer castings tailored to LLVM (link<br>
<<a href="https://sf.snu.ac.kr/publications/llvmtwin.pdf" target="_blank">https://sf.snu.ac.kr/publications/llvmtwin.pdf</a>>).<br>
In this proposal, ptrtoint does not have an escaping side effect; ptrtoint<br>
and inttoptr are scalar operations.<br>
inttoptr simply returns a pointer which can access any object.</p>
</blockquote></div>
<div style="white-space:normal">

<p dir="auto">Skimming your paper, I can see how this works <i>except</i> that I don’t<br>
see any way not to treat <code>ptrtoint</code> as an escape.  And really I think<br>
you’re already partially acknowledging that, because that’s the only<br>
real sense of saying that <code>inttoptr(ptrtoint p)</code> can’t be reduced to<br>
<code>p</code>.  If those are really just scalar operations that don’t expose<br>
<code>p</code> in ways that might be disconnected from the uses of the <code>inttoptr</code><br>
then that reduction ought to be safe.</p></div></div></div></blockquote><div><br></div><div>I haven't read the paper yet, but I think the argument is: Assume p was obtained via an out-of-bounds GEP that happens to point at valid memory that belongs to a different object than p's provenance. In that case, dereferencing inttoptr(ptrtoint(p)) is defined behavior ("inttoptr simply returns a pointer which can access any object") while dereferencing p is UB.</div><div><br></div><div>Cheers,</div><div>Nicolai</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:sans-serif"><div style="white-space:normal">

<p dir="auto">John.</p>
</div>
</div>
</div>

_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Lerne, wie die Welt wirklich ist,<br>aber vergiss niemals, wie sie sein sollte.</div></div>