[flang] Don't needlessly instantiate distinct UNSIGNED cases for FINDLOC (#120471)
[llvm-project.git] / clang / test / CodeGen / ignore-overflow-pattern-false-pos.c
blobb4811443b951921f091eb76a8040ec22f109b282
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-undefined-ignore-overflow-pattern=all %s -emit-llvm -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsanitize=signed-integer-overflow,unsigned-integer-overflow -fsanitize-undefined-ignore-overflow-pattern=all -fwrapv %s -emit-llvm -o - | FileCheck %s
4 // Check for potential false positives from patterns that _almost_ match classic overflow-dependent or overflow-prone code patterns
5 extern unsigned a, b, c;
7 extern unsigned some(void);
9 // Make sure all these still have handler paths, we shouldn't be excluding
10 // instrumentation of any "near" patterns.
11 // CHECK-LABEL: close_but_not_quite
12 void close_but_not_quite(void) {
13 // CHECK: br i1{{.*}}handler.
14 if (a + b > a)
15 c = 9;
17 // CHECK: br i1{{.*}}handler.
18 if (a - b < a)
19 c = 9;
21 // CHECK: br i1{{.*}}handler.
22 if (a + b < a)
23 c = 9;
25 // CHECK: br i1{{.*}}handler.
26 if (a + b + 1 < a)
27 c = 9;
29 // CHECK: br i1{{.*}}handler.
30 // CHECK: br i1{{.*}}handler.
31 if (a + b < a + 1)
32 c = 9;
34 // CHECK: br i1{{.*}}handler.
35 if (b >= a + b)
36 c = 9;
38 // CHECK: br i1{{.*}}handler.
39 if (a + a < a)
40 c = 9;
42 // CHECK: br i1{{.*}}handler.
43 if (a + b == a)
44 c = 9;
46 // CHECK: br i1{{.*}}handler
47 while (--a)
48 some();
51 // CHECK-LABEL: function_calls
52 void function_calls(void) {
53 // CHECK: br i1{{.*}}handler
54 if (some() + b < some())
55 c = 9;
58 // CHECK-LABEL: not_quite_a_negated_unsigned_const
59 void not_quite_a_negated_unsigned_const(void) {
60 // CHECK: br i1{{.*}}handler
61 a = -b;