PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / c-c++-common / pr65120.c
blobc8762e057d5ccf3f9408590bb6c40c0d653c6b62
1 /* { dg-do compile } */
2 /* { dg-options "-Wlogical-not-parentheses" } */
4 /* Test that we don't warn if rhs is 0 and comparison is == or !=. */
6 #ifndef __cplusplus
7 #define bool _Bool
8 #endif
10 bool r;
12 void
13 f1 (int a)
15 r = !a == 0;
16 r = !a != 0;
17 r = !a == 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */
18 r = !a != 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */
21 void
22 f2 (int a)
24 r = !a > 0; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */
25 r = !a >= 0; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */
26 r = !a < 0; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */
27 r = !a <= 0; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */
28 r = !a > 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */
29 r = !a >= 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */
30 r = !a < 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */
31 r = !a <= 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */