<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>This causes a build failure on Darwin:</div><div><pre style="font-family: 'Courier New', courier, monotype, monospace; "><span class="stdout">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><div><br></div><div>Michael</div><br><div><div>On Dec 31, 2012, at 4:20 AM, Will Dietz <<a href="mailto:wdietz2@illinois.edu">wdietz2@illinois.edu</a>> wrote:</div><br class="Apple-interchange-newline"><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">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">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 2147483648 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 -2147483648 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 -2147483648 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">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">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote></div><br></body></html>