(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
Wint-in-bool-context-4.c
       1  /* PR c/102245 */
       2  /* { dg-options "-Wint-in-bool-context" } */
       3  /* { dg-do compile } */
       4  
       5  _Bool test1(_Bool x)
       6  {
       7    return !(x << 0);  /* { dg-warning "boolean context" } */
       8  }
       9  
      10  _Bool test2(_Bool x)
      11  {
      12    return !(x << 1);  /* { dg-warning "boolean context" } */
      13  }
      14  
      15  _Bool test3(_Bool x, int y)
      16  {
      17    return !(x << y);  /* { dg-warning "boolean context" } */
      18  }
      19  
      20  _Bool test4(int x, int y)
      21  {
      22    return !(x << y);  /* { dg-warning "boolean context" } */
      23  }
      24  
      25  _Bool test5(int x, int y)
      26  {
      27    return !((x << y) << 0);  /* { dg-warning "boolean context" } */
      28  }
      29  
      30  int test6(_Bool x)
      31  {
      32    int v = 0;
      33    return (v & ~1L) | (1L & (x << 0));  /* { dg-bogus "boolean context" } */
      34  }
      35