summaryrefslogtreecommitdiff
path: root/test/ubsan/TestCases/ImplicitCast/integer-truncation-blacklist.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/ubsan/TestCases/ImplicitCast/integer-truncation-blacklist.c')
-rw-r--r--test/ubsan/TestCases/ImplicitCast/integer-truncation-blacklist.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ubsan/TestCases/ImplicitCast/integer-truncation-blacklist.c b/test/ubsan/TestCases/ImplicitCast/integer-truncation-blacklist.c
new file mode 100644
index 000000000..221c04b60
--- /dev/null
+++ b/test/ubsan/TestCases/ImplicitCast/integer-truncation-blacklist.c
@@ -0,0 +1,15 @@
+// RUN: rm -f %tmp
+// RUN: echo "[implicit-integer-truncation]" >> %tmp
+// RUN: echo "fun:*implicitTruncation*" >> %tmp
+// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1
+// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1
+// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1
+// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1
+
+unsigned char implicitTruncation(unsigned int argc) {
+ return argc; // BOOM
+}
+
+int main(int argc, char **argv) {
+ return implicitTruncation(~0U);
+}