<div dir="ltr"><div><div>So I made a patch that fixes the "missing epilogue" problem by emitting a trap instruction for IR 'unreachable'.<br></div>A secondary use for it would be for anyone wanting to make double-sure that 'noreturn' functions, indeed, do not return.<br>
<br></div>Would LLVM devs entertain the idea of committing something like this? <br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 17, 2014 at 10:10 AM, Kai Nacke <span dir="ltr"><<a href="mailto:kai.nacke@redstar.de" target="_blank">kai.nacke@redstar.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<div class=""><br>
<br>
On 15.04.2014 23:44, Vadim Chugunov wrote:<br>
</div><div class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
I am curious - how does clang deal with epilogue-less functions that<br>
result from _Raise_Exception being marked 'noreturn'?<br>
I've also been playing with Kai's patch, and discovered that this tends<br>
to greatly confuse Windows stack unwinder in cases when noreturn call is<br>
at the end of a function, so execution appears to flow directly into the<br>
prologue of the next function.<br>
</blockquote>
<br></div>
Yes, that's true. The patch has a problem if the epilogue is dead code and eliminated.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
It looks like MSVC solves this problem by inserting 'int 3' after calls<br>
to noreturns. This is actually the prime motivation for me wanting to<br>
emit code for 'unreachable'<br></div>
<<a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-April/072145.html" target="_blank">http://lists.cs.uiuc.edu/<u></u>pipermail/llvmdev/2014-April/<u></u>072145.html</a>> ...<br>
<br>
Vadim<br>
</blockquote>
<br>
Yaron also pointed out that<br>
<br>
int main() { throw 1; }<br>
<br>
generates two .seh_endprologue instructions. I still did not fix this bug.<br>
<br>
Regards,<br>
Kai<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
<br>
<br>
On Tue, Apr 15, 2014 at 11:43 AM, Martell Malone<br></div><div class="">
<<a href="mailto:martellmalone@gmail.com" target="_blank">martellmalone@gmail.com</a> <mailto:<a href="mailto:martellmalone@gmail.com" target="_blank">martellmalone@gmail.<u></u>com</a>>> wrote:<br>
<br>
Hi,<br>
<br>
I'd like to submit a patch to match the clang patch on the front end.<br>
<a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140414/103257.html" target="_blank">http://lists.cs.uiuc.edu/<u></u>pipermail/cfe-commits/Week-of-<u></u>Mon-20140414/103257.html</a><br>
<br>
The front end doesn't need this patch to work but it's still important.<br>
This is mostly based on work done by kai from <a href="http://redstar.de" target="_blank">redstar.de</a><br></div>
<<a href="http://redstar.de" target="_blank">http://redstar.de</a>><div class=""><br>
<br>
Could I get some feedback on this?<br>
I'm not sure if the emitting of the register names will effect msvc.<br>
<br>
Many Thanks<br>
<br>
Martell Malone<br>
<br>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br></div>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <mailto:<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><div class="">
<br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
<br>
<br>
<br>
<br>
______________________________<u></u>_________________<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/<u></u>mailman/listinfo/llvmdev</a><br>
<br>
</div></blockquote>
<br>
</blockquote></div><br></div></div>