Fix ICE in substring-handling building 502.gcc_r (PR 87562)
[official-gcc.git] / gcc / testsuite / c-c++-common / Wlogical-op-3.c
blob83b5df43ba5289fee13a829317bf7745015ff592
1 /* { dg-do compile } */
2 /* { dg-options "-Wlogical-op" } */
4 void
5 fn1 (int a)
7 const int x = a;
8 if (x && x) {} /* { dg-warning "logical .and. of equal expressions" } */
9 if (x && (int) x) {} /* { dg-warning "logical .and. of equal expressions" } */
10 if ((int) x && x) {} /* { dg-warning "logical .and. of equal expressions" } */
11 if ((int) x && (int) x) {} /* { dg-warning "logical .and. of equal expressions" } */
14 void
15 fn2 (int a)
17 const int x = a;
18 if (x || x) {} /* { dg-warning "logical .or. of equal expressions" } */
19 if (x || (int) x) {} /* { dg-warning "logical .or. of equal expressions" } */
20 if ((int) x || x) {} /* { dg-warning "logical .or. of equal expressions" } */
21 if ((int) x || (int) x) {} /* { dg-warning "logical .or. of equal expressions" } */