<div dir="ltr">Knowing nothing about any of this stuff, I do find this a bit surprising - usually values are opaque to their consumers: they're just a value.<br><br>(especially with pointer bitcasts (which will go away, eventually) - if I have a global variable I've put some executable bytes in and I cast a pointer to that global variable to a pointer to a function, I would expect that should be interchangeable...)</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 28, 2015 at 5:33 PM, Pete Cooper via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Philip<div><br></div><div>While reducing a test case with personality functions, I crashed selection DAG.  The reason being that my personality function was no longer a function.  The relevant code is</div><div><br></div><div>  MF->getMMI().addPersonality(MBB, cast<Function>(LPadInst->getParent()<br>                                                      ->getParent()<br>                                                      ->getPersonalityFn()<br>                                                      ->stripPointerCasts()));</div><div><br></div><div>We get different behavior in this code, which is able to handle non-function personality functions.</div><div><br></div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:#4f8187">EHPersonality</span> <span style="color:#703daa">llvm</span>::classifyEHPersonality(<span style="color:#bb2ca2">const</span> <span style="color:#4f8187">Value</span> *Pers) {</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(49,89,93)"><span style="color:#000000">  </span><span style="color:#bb2ca2">const</span><span style="color:#000000"> </span><span style="color:#4f8187">Function</span><span style="color:#000000"> *F = </span>dyn_cast<span style="color:#000000"><</span><span style="color:#4f8187">Function</span><span style="color:#000000">>(Pers-></span>stripPointerCasts<span style="color:#000000">());</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">  <span style="color:#bb2ca2">if</span> (!F)</div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span style="color:#000000">    </span><span style="color:#bb2ca2">return</span><span style="color:#000000"> </span>EHPersonality<span style="color:#000000">::</span><span style="color:#31595d">Unknown</span><span style="color:#000000">;</span></div></div><div><br></div><div>And finally, LangRef itself implies that its a function as it says that we should 'specify what function to use for exception handling’.</div><div><br></div><div>So i’m not sure exactly what behavior we want.</div><div><br></div><div>However, assuming we do want personality functions to always actually be functions (which was what i originally thought we wanted), here’s a patch which teaches the verifier this.</div><div><br></div><div>Comments welcome, including the possibility that this is completely wrong and that we do want to support other values as personalities.</div><div><br></div><div>Cheers</div><span class="HOEnZb"><font color="#888888"><div>Pete</div><div><br></div><div></div></font></span></div><br><div style="word-wrap:break-word"><div></div></div><br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>