<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Dec 26, 2016 at 4:34 AM Marina Yatsina via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: myatsina<br class="gmail_msg">
Date: Mon Dec 26 06:23:42 2016<br class="gmail_msg">
New Revision: 290539<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=290539&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=290539&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
[inline-asm]No error for conflict between inputs\outputs and clobber list<br class="gmail_msg">
<br class="gmail_msg">
According to extended asm syntax, a case where the clobber list includes a variable from the inputs or outputs should be an error - conflict.<br class="gmail_msg">
for example:<br class="gmail_msg">
<br class="gmail_msg">
const long double a = 0.0;<br class="gmail_msg">
int main()<br class="gmail_msg">
{<br class="gmail_msg">
<br class="gmail_msg">
char b;<br class="gmail_msg">
double t1 = a;<br class="gmail_msg">
__asm__ ("fucompp": "=a" (b) : "u" (t1), "t" (t1) : "cc", "st", "st(1)");<br class="gmail_msg">
<br class="gmail_msg">
return 0;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
This should conflict with the output - t1 which is st, and st which is st aswell.<br class="gmail_msg">
The patch fixes it. </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="gmail_msg">
Commit on behald of Ziv Izhar.<br class="gmail_msg">
<br class="gmail_msg">
Differential Revision: <a href="https://reviews.llvm.org/D15075" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D15075</a><br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Modified:<br class="gmail_msg">
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br class="gmail_msg">
    cfe/trunk/include/clang/Basic/TargetInfo.h<br class="gmail_msg">
    cfe/trunk/lib/Basic/TargetInfo.cpp<br class="gmail_msg">
    cfe/trunk/lib/Basic/Targets.cpp<br class="gmail_msg">
    cfe/trunk/lib/Headers/intrin.h<br class="gmail_msg">
    cfe/trunk/lib/Sema/SemaStmtAsm.cpp<br class="gmail_msg">
    cfe/trunk/test/Sema/asm.c<br class="gmail_msg">
<br class="gmail_msg">
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=290539&r1=290538&r2=290539&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=290539&r1=290538&r2=290539&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)<br class="gmail_msg">
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Dec 26 06:23:42 2016<br class="gmail_msg">
@@ -7069,6 +7069,10 @@ let CategoryName = "Inline Assembly Issu<br class="gmail_msg">
     "constraint '%0' is already present here">;<br class="gmail_msg">
 }<br class="gmail_msg">
<br class="gmail_msg">
+  def error_inoutput_conflict_with_clobber : Error<<br class="gmail_msg">
+    "asm-specifier for input or output variable conflicts with asm"<br class="gmail_msg">
+    " clobber list">;<br class="gmail_msg"></blockquote><div><br></div><div>Clang generally works to avoid this kind of error message. All this does is say "there was a problem of this kind" without identifying any of the specifics. And for this error in particular I think this is of the utmost importance. Developers are not going to understand what went wrong here.</div><div><br></div><div>I would suggest at a minimum to enhance this to explain:</div><div><br></div><div>1) What operands and clobbers conflict, preferably with source ranges underlining them.</div><div><br></div><div>2) Why they conflict (for example the fact that "D" means the di register group, of which "%rdi" is a member)</div><div><br></div><div>Beyond that, I wonder if you could add a note suggesting to remove the clobber if the input (or output) operand is sufficient.</div><div><br></div><div>You can make this note explain carefully the case where something would need to be added to the inputs or outputs instead, but I think it at least makes sense to clarify that this will be a common fix and what to look out for that might make it an incorrect fix.</div></div></div>