1  /* PR c/68412 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-Wall -Wextra" } */
       4  
       5  #define M (sizeof (int) * __CHAR_BIT__)
       6  
       7  int
       8  fn1 (int i)
       9  {
      10    return i == (-1 << 8); /* { dg-warning "left shift of negative value" } */
      11  }
      12  
      13  int
      14  fn2 (int i)
      15  {
      16    return i == (1 << M); /* { dg-warning "left shift count" } */
      17  }
      18  
      19  int
      20  fn3 (int i)
      21  {
      22    return i == 10 << (M - 1); /* { dg-warning "requires" } */
      23  }
      24  
      25  int
      26  fn4 (int i)
      27  {
      28    return i == 1 << -1; /* { dg-warning "left shift count" } */
      29  }
      30  
      31  int
      32  fn5 (int i)
      33  {
      34    return i == 1 >> M; /* { dg-warning "right shift count" } */
      35  }
      36  
      37  int
      38  fn6 (int i)
      39  {
      40    return i == 1 >> -1; /* { dg-warning "right shift count" } */
      41  }