Skip to content

Commit 0927d4d

Browse files
committed
Dump the value of the signed unsigned char
1 parent c3dc63d commit 0927d4d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

clang/test/Analysis/out-of-bounds.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %clang_analyze_cc1 -Wno-array-bounds -analyzer-checker=core,security.ArrayBound,debug.ExprInspection -verify %s
22

33
void clang_analyzer_eval(int);
4+
void clang_analyzer_value(int);
45

56
// Tests doing an out-of-bounds access after the end of an array using:
67
// - constant integer index
@@ -203,6 +204,7 @@ int test_cast_to_unsigned(signed char x) {
203204
// load a negative value from an unsigned variable. This causes an underflow
204205
// report, which is an ugly false positive.
205206
// The underlying issue is tracked by Github ticket #39492.
207+
clang_analyzer_value(y); // expected-warning {{8s:{ [-128, -1] } }}
206208
return table[y]; // expected-warning {{Out of bound access to memory preceding}}
207209
}
208210

@@ -214,6 +216,7 @@ int test_cast_to_unsigned_overflow(signed char x) {
214216
// an overflow report (because the negative values are cast to `unsigned
215217
// char` values that are too large).
216218
// FIXME: See comment in 'test_cast_to_unsigned'.
219+
clang_analyzer_value(y); // expected-warning {{8s:{ [-128, -1] } }}
217220
return small_table[y]; // expected-warning {{Out of bound access to memory preceding}}
218221
}
219222

0 commit comments

Comments
 (0)