1// RUN: %clangxx -fsanitize=undefined %s -o %t && %run %t 2>&1 | FileCheck %s
2// Verify deduplication works by ensuring only one diag is emitted.
3#include <limits.h>
4#include <stdio.h>
5
6void overflow() {
7 int i = INT_MIN;
8 --i;
9}
10
11int main() {
12 // CHECK: Start
13 fprintf(stderr, format: "Start\n");
14 fflush(stderr);
15
16 // CHECK: runtime error
17 // CHECK-NOT: runtime error
18 // CHECK-NOT: runtime error
19 overflow();
20 overflow();
21 overflow();
22
23 // CHECK: End
24 fprintf(stderr, format: "End\n");
25 return 0;
26}
27

source code of compiler-rt/test/ubsan/TestCases/Misc/deduplication.cpp