<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><div dir="ltr"><div class="gmail_default" style>This breaks everyone's build -- this just doesn't compile.</div><div class="gmail_default" style>
<br></div><div class="gmail_default" style>I've reverted this in r171277 until Will can look at it. Will, please double check that you've built successfully before re-committing it.</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sun, Dec 30, 2012 at 10:05 PM, Michael Gottesman <span dir="ltr"><<a href="mailto:mgottesman@apple.com" target="_blank">mgottesman@apple.com</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"><div>This causes a build failure on Darwin:</div><div><pre style="font-family:'Courier New',courier,monotype,monospace"><span>compiler-rt/lib/ubsan/ubsan_handlers.cc:107:10: error: use of undeclared identifier 'Loc'
    Diag(Loc, DL_Error,
         ^
compiler-rt/lib/ubsan/ubsan_handlers.cc:112:10: error: use of undeclared identifier 'Loc'
    Diag(Loc, DL_Error,</span></pre><div>I noticed in the function handleTypeMismatchImpl you explicitly grab Loc so I am assuming this is an error in your code.</div></div><div><br></div><div>Can you fix this?</div><span class="HOEnZb"><font color="#888888"><div>
<br></div><div>Michael</div></font></span><div><div class="h5"><br><div><div>On Dec 31, 2012, at 4:20 AM, Will Dietz <<a href="mailto:wdietz2@illinois.edu" target="_blank">wdietz2@illinois.edu</a>> wrote:</div><br><blockquote type="cite">
Author: wdietz2<br>Date: Sun Dec 30 20:20:55 2012<br>New Revision: 171273<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=171273&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=171273&view=rev</a><br>
Log:<br>[ubsan] Don't suggest casting to unsigned for unsigned unary minus overflow.<br><br>Modified:<br>    compiler-rt/trunk/lib/ubsan/lit_tests/Integer/negate-overflow.cpp<br>    compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc<br>
<br>Modified: compiler-rt/trunk/lib/ubsan/lit_tests/Integer/negate-overflow.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/lit_tests/Integer/negate-overflow.cpp?rev=171273&r1=171272&r2=171273&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/lit_tests/Integer/negate-overflow.cpp?rev=171273&r1=171272&r2=171273&view=diff</a><br>
==============================================================================<br>--- compiler-rt/trunk/lib/ubsan/lit_tests/Integer/negate-overflow.cpp (original)<br>+++ compiler-rt/trunk/lib/ubsan/lit_tests/Integer/negate-overflow.cpp Sun Dec 30 20:20:55 2012<br>
@@ -1,7 +1,12 @@<br>-// RUN: %clang -fsanitize=signed-integer-overflow %s -o %t && %t 2>&1 | FileCheck %s<br>+// RUN: %clang -fsanitize=signed-integer-overflow %s -o %t && %t 2>&1 | FileCheck %s --check-prefix=CHECKS<br>
+// RUN: %clang -fsanitize=unsigned-integer-overflow %s -o %t && %t 2>&1 | FileCheck %s --check-prefix=CHECKU<br><br> int main() {<br>+  // CHECKS-NOT: runtime error<br>+  // CHECKU: negate-overflow.cpp:[[@LINE+2]]:3: runtime error: negation of <a href="tel:2147483648" value="+12147483648" target="_blank">2147483648</a> cannot be represented in type 'unsigned int'<br>
+  // CHECKU-NOT: cast to an unsigned<br>   -unsigned(-0x7fffffff - 1); // ok<br>-  // CHECK: negate-overflow.cpp:6:10: runtime error: negation of -<a href="tel:2147483648" value="+12147483648" target="_blank">2147483648</a> cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself<br>
+  // CHECKS: negate-overflow.cpp:[[@LINE+2]]:10: runtime error: negation of -<a href="tel:2147483648" value="+12147483648" target="_blank">2147483648</a> cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself<br>
+  // CHECKU-NOT: runtime error<br>   return -(-0x7fffffff - 1);<br> }<br><br>Modified: compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc<br>URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc?rev=171273&r1=171272&r2=171273&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc?rev=171273&r1=171272&r2=171273&view=diff</a><br>
==============================================================================<br>--- compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc (original)<br>+++ compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc Sun Dec 30 20:20:55 2012<br>
@@ -103,10 +103,15 @@<br><br> void __ubsan::__ubsan_handle_negate_overflow(OverflowData *Data,<br>                                              ValueHandle OldVal) {<br>-  Diag(Data->Loc, DL_Error,<br>-       "negation of %0 cannot be represented in type %1; "<br>
-       "cast to an unsigned type to negate this value to itself")<br>-    << Value(Data->Type, OldVal) << Data->Type;<br>+  if (Data->Type.isSignedIntegerTy())<br>+    Diag(Loc, DL_Error,<br>
+         "negation of %0 cannot be represented in type %1; "<br>+         "cast to an unsigned type to negate this value to itself")<br>+      << Value(Data->Type, OldVal) << Data->Type;<br>
+  else<br>+    Diag(Loc, DL_Error,<br>+         "negation of %0 cannot be represented in type %1")<br>+      << Value(Data->Type, OldVal) << Data->Type;<br> }<br> void __ubsan::__ubsan_handle_negate_overflow_abort(OverflowData *Data,<br>
                                                     ValueHandle OldVal) {<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></blockquote></div><br></div></div></div><br>_______________________________________________<br>

llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>