(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
Wstringop-overflow-82.c
       1  /* Verify that notes after warnings for array and VLA parameters show
       2     the array form.
       3     { dg-do compile }
       4     { dg-options "-Wall" } */
       5  
       6  void fia5 (int[5]);
       7  
       8  void gia3_fia5 (void)
       9  {
      10    int a[3];
      11    fia5 (a);             // { dg-warning "-Wstringop-overflow" }
      12                          // { dg-message "argument 1 of type 'int\\\[5]'" "note" { target *-*-* } .-1 }
      13  }
      14  
      15  
      16  /* The type of the argument would ideall be 'int[n]' but the variable
      17     bound is lost/cleared by free-lang-data and never makes it into
      18     the middle end.  An (inferior) alternative would be 'int[*]' but
      19     the pretty printer doesn't know how to format the star.  A better
      20     solution might be to introduce a new notation, like 'int[$1]',
      21     where the $1 refers to the VLA argument bound.  */
      22  void fvla (int n, int[n]);
      23  
      24  void gia3_fvla (void)
      25  {
      26    int a[3];
      27    fvla (sizeof a, a);   // { dg-warning "-Wstringop-overflow" }
      28                          // { dg-message "argument 2 of type 'int\\\[]'" "note" { target *-*-* } .-1 }
      29  }