(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
Wvla-parameter-10.c
       1  /* PR c/100719 - missing -Wvla-parameter on a mismatch in second parameter
       2     { dg-do compile }
       3     { dg-options "-Wall" } */
       4  
       5  typedef struct A1 { int i; } A1;
       6  typedef struct A2 { int i; } A2;
       7  typedef struct A3 { int i; } A3;
       8  
       9  void f2 (int n, A1[n], A2[n]);
      10  void f2 (int n, A1[n], A2[n]);
      11  
      12  void f2_x1 (int n, A1[n],     A2[n]);   // { dg-note "previously declared as 'A1\\\[n]' with bound argument 1" }
      13  void f2_x1 (int n, A1[n + 1], A2[n]);   // { dg-warning "argument 2 of type 'A1\\\[n \\+ 1]' declared with mismatched bound 'n \\+ 1'" }
      14  
      15  void f2_x2 (int n, A1[n], A2[n]);       // { dg-note "previously declared as 'A2\\\[n]' with bound argument 1" }
      16  void f2_x2 (int n, A1[n], A2[n + 2]);   // { dg-warning "argument 3 of type 'A2\\\[n \\+ 2]' declared with mismatched bound 'n \\+ 2'" }
      17  
      18  
      19  void f3 (int n, A1[n], A2[n], A3[n]);
      20  void f3 (int n, A1[n], A2[n], A3[n]);
      21  
      22  void f3_x1 (int n, A1[n],     A2[n], A3[n]);
      23  // { dg-note "previously declared as 'A1\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
      24  void f3_x1 (int n, A1[n + 1], A2[n], A3[n]);
      25  // { dg-warning "argument 2 of type 'A1\\\[n \\+ 1]' declared with mismatched bound 'n \\+ 1'" "" { target *-*-* } .-1 }
      26  
      27  void f3_x2 (int n, A1[n], A2[n],     A3[n]);
      28  // { dg-note "previously declared as 'A2\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
      29  void f3_x2 (int n, A1[n], A2[n + 2], A3[n]);
      30  // { dg-warning "argument 3 of type 'A2\\\[n \\+ 2]' declared with mismatched bound 'n \\+ 2'" "" { target *-*-* } .-1 }
      31  
      32  void f3_x3 (int n, A1[n], A2[n], A3[n]);
      33  // { dg-note "previously declared as 'A3\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
      34  void f3_x3 (int n, A1[n], A2[n], A3[n + 3]);
      35  // { dg-warning "argument 4 of type 'A3\\\[n \\+ 3]' declared with mismatched bound 'n \\+ 3'" "" { target *-*-* } .-1 }
      36  
      37  
      38  void g3_x1 (int n, A1[n],     A2[*], A3[n]);
      39  // { dg-note "previously declared as 'A1\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
      40  void g3_x1 (int n, A1[n + 1], A2[*], A3[n]);
      41  // { dg-warning "argument 2 of type 'A1\\\[n \\+ 1]' declared with mismatched bound 'n \\+ 1'" "" { target *-*-* } .-1 }
      42  
      43  void g3_x2 (int n, A1[*], A2[n],     A3[n]);
      44  // { dg-note "previously declared as 'A2\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
      45  void g3_x2 (int n, A1[*], A2[n + 2], A3[n]);
      46  // { dg-warning "argument 3 of type 'A2\\\[n \\+ 2]' declared with mismatched bound 'n \\+ 2'" "" { target *-*-* } .-1 }
      47  
      48  void g3_x3 (int n, A1[*], A2[*], A3[n]);
      49  // { dg-note "previously declared as 'A3\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
      50  void g3_x3 (int n, A1[*], A2[*], A3[n + 3]);
      51  // { dg-warning "argument 4 of type 'A3\\\[n \\+ 3]' declared with mismatched bound 'n \\+ 3'" "" { target *-*-* } .-1 }
      52  
      53  
      54  void h3_x1 (int n, A1[n],     A2[ ], A3[n]);
      55  // { dg-note "previously declared as 'A1\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
      56  void h3_x1 (int n, A1[n + 1], A2[ ], A3[n]);
      57  // { dg-warning "argument 2 of type 'A1\\\[n \\+ 1]' declared with mismatched bound 'n \\+ 1'" "" { target *-*-* } .-1 }
      58  
      59  void h3_x2 (int n, A1[ ], A2[n],     A3[n]);
      60  // { dg-note "previously declared as 'A2\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
      61  void h3_x2 (int n, A1[ ], A2[n + 2], A3[n]);
      62  // { dg-warning "argument 3 of type 'A2\\\[n \\+ 2]' declared with mismatched bound 'n \\+ 2'" "" { target *-*-* } .-1 }
      63  
      64  void h3_x3 (int n, A1[ ], A2[ ], A3[n]);
      65  // { dg-note "previously declared as 'A3\\\[n]' with bound argument 1" "note" { target *-*-* } .-1 }
      66  void h3_x3 (int n, A1[ ], A2[ ], A3[n + 3]);
      67  // { dg-warning "argument 4 of type 'A3\\\[n \\+ 3]' declared with mismatched bound 'n \\+ 3'" "" { target *-*-* } .-1 }
      68