<div dir="ltr"><div dir="ltr">> %p2 = gep %p, (undef & 8)<div>A silly typo: undef & 8 -> undef & 7</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 21, 2020 at 7:47 AM Juneyoung Lee <<a href="mailto:juneyoung.lee@sf.snu.ac.kr">juneyoung.lee@sf.snu.ac.kr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hello all,</div><div><br></div><div>Is it valid to dereference a pointer that has undef bits in its offset?<br></div><div><br></div><div>For example,</div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr">%p = alloca [8 x i8]</div><div dir="ltr">%p2 = gep %p, (undef & 8)</div><div dir="ltr">store 0, %p2</div><div dir="ltr"><br></div><div dir="ltr">undef & 8 is always less than 8, so technically it will store zero to one of the array's elements.<br></div></div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr">The reason is that I want to improve no-undef analysis by suggesting that a pointer that is passed to load/store is well-defined, by making it raise UB when a pointer with undef bits is given.</div></div><div dir="ltr"><br></div><div dir="ltr">A suggested patch is here: <a href="https://reviews.llvm.org/D87994" target="_blank">https://reviews.llvm.org/D87994</a><br clear="all"><div><br></div><div>I wonder whether there is a case using this to do something that I'm not aware.</div><div><br></div><div>Thanks,</div><div>Juneyoung</div></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><br></div><font size="1">Juneyoung Lee</font><div><font size="1">Software Foundation Lab, Seoul National University</font></div></div></div>