[compiler-rt] r235569 - [UBSan] Unify the way we report overflow in increment/decrement operator.

Alexey Samsonov vonosmas at gmail.com
Wed Apr 22 18:50:56 PDT 2015


Author: samsonov
Date: Wed Apr 22 20:50:56 2015
New Revision: 235569

URL: http://llvm.org/viewvc/llvm-project?rev=235569&view=rev
Log:
[UBSan] Unify the way we report overflow in increment/decrement operator.

Modified:
    compiler-rt/trunk/test/ubsan/TestCases/Integer/incdec-overflow.cpp

Modified: compiler-rt/trunk/test/ubsan/TestCases/Integer/incdec-overflow.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan/TestCases/Integer/incdec-overflow.cpp?rev=235569&r1=235568&r2=235569&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan/TestCases/Integer/incdec-overflow.cpp (original)
+++ compiler-rt/trunk/test/ubsan/TestCases/Integer/incdec-overflow.cpp Wed Apr 22 20:50:56 2015
@@ -1,7 +1,7 @@
-// RUN: %clangxx -DOP=n++ -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx -DOP=++n -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx -DOP=m-- -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx -DOP=--m -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx -DOP=n++ -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=PLUS
+// RUN: %clangxx -DOP=++n -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=PLUS
+// RUN: %clangxx -DOP=m-- -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=MINUS
+// RUN: %clangxx -DOP=--m -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=MINUS
 
 #include <stdint.h>
 
@@ -10,7 +10,7 @@ int main() {
   n++;
   n++;
   int m = -n - 1;
-  // CHECK: incdec-overflow.cpp:15:3: runtime error: signed integer overflow: [[MINUS:-?]]214748364
-  // CHECK: + [[MINUS]]1 cannot be represented in type 'int'
   OP;
+  // PLUS: incdec-overflow.cpp:[[@LINE-1]]:3: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
+  // MINUS: incdec-overflow.cpp:[[@LINE-2]]:3: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
 }





More information about the llvm-commits mailing list