(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
Warray-bounds-85.c
       1  /* PR middle-end/101601 - [12 Regression] -Warray-bounds triggers error:
       2     arrays of functions are not meaningful
       3     { dg-do compile }
       4     { dg-options "-O2 -Wall" } */
       5  
       6  typedef void Fvv (void);
       7  
       8  extern Fvv* pf;       // { dg-message "'pf'" }
       9  
      10  void f (void*);
      11  
      12  void test_funptr (void)
      13  {
      14    f (&pf);
      15    f (&pf + 1);
      16    f (&pf + 2);        // { dg-warning "subscript 2 is outside array bounds of 'void \\\(\\\*\\\[1]\\\)\\\(void\\\)'" }
      17  }
      18  
      19  typedef int Fii_ (int, ...);
      20  
      21  extern Fii_* pfa[3];  // { dg-message "'pfa'" }
      22  
      23  void test_funptr_array (void)
      24  {
      25    f (pfa);
      26    f (pfa + 1);
      27    f (pfa + 2);
      28    f (pfa + 3);
      29    f (pfa + 4);        // { dg-warning "subscript 4 is outside array bounds of 'int \\\(\\\*\\\[3]\\\)\\\(int, ...\\\)'" }
      30  }