<div dir="ltr"><div>This patch makes the following changes to improve error handling of x86 inline-asm constraint '=f'. According to the following link, it is a mistake to use the 'f' constraint for output operands. </div>

<div><br></div><div><div><a href="https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html" target="_blank">https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html</a><br></div></div><div><br></div><div>1. Override TargetLowering::ComputeConstraintToUse so that this error can be detected during instruction selection. Currently, it's detected in the x86 FP stackifier pass (X86FloatingPoint.cpp), which is a pass that is run much later.</div>

<div><br></div><div>2. Terminate immediately after this error is detected. Currently, clang continues compiling the program after seeing this error, because the inline-asm diagnostic handler that is installed doesn't terminate upon seeing this error. As an example of why this is bad, I attached a program that exposes an internal error when compiled with clang. clang didn't stop compiling until it hit a call to report_fatal_error.</div>

<div><br></div><div><p style="margin:0px;font-size:11px;font-family:Menlo"><b>main.c:17:7: </b><span style="color:rgb(195,55,32)"><b>error: </b></span><b>illegal "f" output constraint</b></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">      ".intel_syntax\n"</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(52,189,38)"><b>      ^</b></p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span style="color:rgb(195,55,32)"><b>fatal error: </b></span>error in backend: Access past stack top!</p><p style="margin:0px;font-size:11px;font-family:Menlo"><br>

</p><p style="margin:0px;font-size:11px;font-family:Menlo"><rdar://problem/17476689><br></p></div></div>