aboutsummaryrefslogtreecommitdiff
path: root/test/ubsan_minimal/TestCases/uadd-overflow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/ubsan_minimal/TestCases/uadd-overflow.cpp')
-rw-r--r--test/ubsan_minimal/TestCases/uadd-overflow.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ubsan_minimal/TestCases/uadd-overflow.cpp b/test/ubsan_minimal/TestCases/uadd-overflow.cpp
new file mode 100644
index 000000000000..034575012325
--- /dev/null
+++ b/test/ubsan_minimal/TestCases/uadd-overflow.cpp
@@ -0,0 +1,10 @@
+// RUN: %clangxx -fsanitize=unsigned-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx -fsanitize=unsigned-integer-overflow -fno-sanitize-recover=all %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
+
+#include <stdint.h>
+
+int main() {
+ uint32_t k = 0x87654321;
+ k += 0xedcba987;
+ // CHECK: add-overflow
+}