1 /* PR c/100719 - missing -Wvla-parameter on a mismatch in second parameter
3 { dg-options "-Wall" } */
5 typedef struct A1
{ int i
; } A1
;
6 typedef struct A2
{ int i
; } A2
;
7 typedef struct A3
{ int i
; } A3
;
9 void f2 (int n
, A1
[n
], A2
[n
]);
10 void f2 (int n
, A1
[n
], A2
[n
]);
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'" }
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'" }
19 void f3 (int n
, A1
[n
], A2
[n
], A3
[n
]);
20 void f3 (int n
, A1
[n
], A2
[n
], A3
[n
]);
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }