gcc/testsuite/gcc.dg/pr32207.c
raw| 1 | /* Test warning for comparison non-null address with null pointer constant. */ |
| 2 | /* Origin: Pawel Sikora <[email protected]> */ |
| 3 | /* { dg-do compile } */ |
| 4 | /* { dg-options "-Waddress" } */ |
| 5 | extern void z(); |
| 6 | |
| 7 | void f() { if ( z ) z(); } /* { dg-warning "always evaluate as" } */ |
| 8 | void g() { if ( z != 0 ) z(); } /* { dg-warning "the comparison will always evaluate as 'true'" } */ |
| 9 | void h() { if ( z != (void*)0 ) z(); } /* { dg-warning "the comparison will always evaluate as 'true'" } */ |