<div dir="ltr"><div>Doing this would make clang's diagnostic output dependent on the optimization level, which is absolutely verboten.<br></div><div><br></div><div>Also, a ud2 doesn't mean your program has a bug, and I doubt an asm-level diagnostic would be useful to anyone.</div>
<div><br></div><div>A ud2 just means "if control flow ever reaches this point, the program has undefined behavior"; in that sense, they don't even have to be emitted.</div><div><br></div>btw, compiling with -fsanitize=undefined should turn most/all of those ud2's into runtime checks that will give you a nice diagnostic if they are violated.<div>
<div><br></div><div>-- Sean Silva</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 3, 2013 at 8:58 PM, Mikael Lyngvig <span dir="ltr"><<a href="mailto:mikael@lyngvig.org" target="_blank">mikael@lyngvig.org</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">Is it just me or would it be nifty if Clang emitted a warning message when it generates an "ud2" (UnDefined2) instruction. I know this is x86-specific, but it would be sort of nice to know up front. After all, the compiler knows perfectly well that it is outputting an "ud2" instruction and I'm pretty sure almost every programmer out there would like to share the unhappy news.<span class="HOEnZb"><font color="#888888"><div>
<br></div><div><div><br></div><div>-- Mikael</div><div><br></div></div></font></span></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>