(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
invalid-shift-1.c
       1  /* PR tree-optimization/97424.  */
       2  
       3  #include <stdint.h>
       4  
       5  static inline uint32_t
       6  _dl_hwcaps_subdirs_build_bitmask (int subdirs, int active)
       7  {
       8    /* Leading subdirectories that are not active.  */
       9    int inactive = subdirs - active;
      10    if (inactive == 32)
      11      return 0;
      12  
      13    uint32_t mask;
      14    if (subdirs != 32)
      15      mask = (1 << subdirs) - 1; /* { dg-message "shift by count \\('33'\\) >= precision of type \\('\[0-9\]+'\\)" } */
      16    else
      17      mask = -1;
      18    return mask ^ ((1U << inactive) - 1); /* { dg-message "shift by negative count \\('-1'\\)" } */
      19  }
      20  
      21  void f1 (int);
      22  
      23  void
      24  f2 (void)
      25  {
      26    f1 (_dl_hwcaps_subdirs_build_bitmask (1, 2));
      27    f1 (_dl_hwcaps_subdirs_build_bitmask (33, 31));
      28  }
      29  
      30  static int __attribute__((noinline)) op3 (int op, int c) { return op << c; } /* { dg-message "shift by negative count \\('-1'\\)" } */
      31  int test_3 (void) { return op3 (1, -1); }
      32  
      33  static int __attribute__((noinline)) op4 (int op, int c) { return op << c; }
      34  int test_4 (void) { return op4 (1, 0); }