1 // RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify -analyzer-constraints=range %s
3 // These are used to trigger warnings.
4 typedef typeof(sizeof(int)) size_t;
7 #define NULL ((void*)0)
8 #define UINT_MAX (__INT_MAX__ *2U +1U)
10 // Each of these adjusted ranges has an adjustment small enough to split the
11 // solution range across an overflow boundary (Min for <, Max for >).
12 // This corresponds to one set of branches in RangeConstraintManager.
13 void smallAdjustmentGT (unsigned a) {
17 if (a == UINT_MAX-1 || a == UINT_MAX)
19 else if (a < UINT_MAX-1)
24 void smallAdjustmentGE (unsigned a) {
30 else if (a < UINT_MAX-1 || a == UINT_MAX)
35 void smallAdjustmentLT (unsigned a) {
39 if (a == 0 || a == UINT_MAX)
44 void smallAdjustmentLE (unsigned a) {
48 if (a == 0 || a == 1 || a == UINT_MAX)
54 // Each of these adjusted ranges has an adjustment large enough to push the
55 // comparison value over an overflow boundary (Min for <, Max for >).
56 // This corresponds to one set of branches in RangeConstraintManager.
57 void largeAdjustmentGT (unsigned a) {
68 void largeAdjustmentGE (unsigned a) {
70 if (a-2 >= UINT_MAX-1)
74 else if (a == 1 || a == 0)
79 void largeAdjustmentLT (unsigned a) {
83 if (a == UINT_MAX-1 || a == UINT_MAX)
85 else if (a < UINT_MAX-1)
90 void largeAdjustmentLE (unsigned a) {
96 else if (a == UINT_MAX-1 || a == UINT_MAX)