Let tree_single_nonzero_warnv_p use range information
[official-gcc.git] / gcc / testsuite / gcc.dg / pr59846.c
blobb3dd0de9ea68e38c0a9667c382fdca62de9d64c4
1 /* PR c/59846 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wlogical-op -Wtype-limits" } */
5 _Bool
6 fn1 (unsigned int p)
8 return 0ULL > p; /* { dg-warning "15:comparison is always false due to limited range of data type" } */
11 _Bool
12 fn2 (unsigned int p)
14 return 0ULL <= p; /* { dg-warning "15:comparison is always true due to limited range of data type" } */
17 _Bool
18 fn3 (unsigned int p)
20 return p >= 0U; /* { dg-warning "12:comparison of unsigned expression >= 0 is always true" } */
23 _Bool
24 fn4 (unsigned int p)
26 return p < 0U; /* { dg-warning "12:comparison of unsigned expression < 0 is always false" } */
29 _Bool
30 fn5 (_Bool p)
32 return p || !p; /* { dg-warning "12:logical" } */
35 _Bool
36 fn6 (_Bool p)
38 return p && !p; /* { dg-warning "12:logical" } */