[RISCV] Add shrinkwrap test cases showing gaps in current impl
[llvm-project.git] / clang / test / Analysis / assuming-unsigned-ge-0.c
blob553e68cb96c6bd37bedd1a9fc445d7f09d1e909d
1 // RUN: %clang_analyze_cc1 -analyzer-output=text \
2 // RUN: -analyzer-checker=core -verify %s
4 int assuming_unsigned_ge_0(unsigned arg) {
5 // TODO This testcase demonstrates the current incorrect behavior of Clang
6 // Static Analyzer: here 'arg' is unsigned, so "arg >= 0" is not a fresh
7 // assumption, but it still appears in the diagnostics as if it's fresh:
8 // expected-note@+2 {{Assuming 'arg' is >= 0}}
9 // expected-note@+1 {{Taking false branch}}
10 if (arg < 0)
11 return 0;
12 // expected-note@+2 {{Assuming 'arg' is <= 0}}
13 // expected-note@+1 {{Taking false branch}}
14 if (arg > 0)
15 return 0;
16 // expected-note@+2 {{Division by zero}}
17 // expected-warning@+1 {{Division by zero}}
18 return 100 / arg;