Skip to content

Commit 2805028

Browse files
committed
Add test with a C array
1 parent 9c432ba commit 2805028

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clang/test/Sema/tautological-pointer-comparison.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ int ptr_ule_add_idx_ptr(const char *ptr, unsigned index) {
3232
return ptr <= index + ptr; // expected-warning {{pointer comparison always evaluates to true}}
3333
}
3434

35+
int add_ptr_idx_ult_ptr_array(unsigned index) {
36+
char ptr[10];
37+
return ptr + index < ptr; // expected-warning {{pointer comparison always evaluates to false}}
38+
}
39+
3540
// Negative tests with wrong predicate.
3641

3742
int add_ptr_idx_ule_ptr(const char *ptr, unsigned index) {

0 commit comments

Comments
 (0)