diff options
Diffstat (limited to 'test/ubsan/TestCases/Misc/deduplication.cpp')
-rw-r--r-- | test/ubsan/TestCases/Misc/deduplication.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ubsan/TestCases/Misc/deduplication.cpp b/test/ubsan/TestCases/Misc/deduplication.cpp new file mode 100644 index 0000000000000..7d7b0bd58c6ed --- /dev/null +++ b/test/ubsan/TestCases/Misc/deduplication.cpp @@ -0,0 +1,25 @@ +// RUN: %clangxx -fsanitize=undefined %s -o %t && %run %t 2>&1 | FileCheck %s +// Verify deduplication works by ensuring only one diag is emitted. +#include <limits.h> +#include <stdio.h> + +void overflow() { + int i = INT_MIN; + --i; +} + +int main() { + // CHECK: Start + fprintf(stderr, "Start\n"); + + // CHECK: runtime error + // CHECK-NOT: runtime error + // CHECK-NOT: runtime error + overflow(); + overflow(); + overflow(); + + // CHECK: End + fprintf(stderr, "End\n"); + return 0; +} |