| 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 |
extern int n, n1, n2, n3; |
| 10 |
|
| 11 |
void f2 (int, A1[n], A2[n]); |
| 12 |
void f2 (int, A1[n], A2[n]); |
| 13 |
|
| 14 |
void f2_x1 (int, A1[n], A2[n]); // { dg-note "previously declared as 'A1\\\[n]'" } |
| 15 |
void f2_x1 (int, A1[n1], A2[n]); // { dg-warning "argument 2 of type 'A1\\\[n1]' declared with mismatched bound 'n1'" } |
| 16 |
|
| 17 |
void f2_x2 (int, A1[n], A2[n]); // { dg-note "previously declared as 'A2\\\[n]'" } |
| 18 |
void f2_x2 (int, A1[n], A2[n2]); // { dg-warning "argument 3 of type 'A2\\\[n2]' declared with mismatched bound 'n2'" } |
| 19 |
|
| 20 |
|
| 21 |
void f3 (int, A1[n], A2[n], A3[n]); |
| 22 |
void f3 (int, A1[n], A2[n], A3[n]); |
| 23 |
|
| 24 |
void f3_x1 (int, A1[n], A2[n], A3[n]); |
| 25 |
// { dg-note "previously declared as 'A1\\\[n]'" "note" { target *-*-* } .-1 } |
| 26 |
void f3_x1 (int, A1[n1], A2[n], A3[n]); |
| 27 |
// { dg-warning "argument 2 of type 'A1\\\[n1]' declared with mismatched bound 'n1'" "" { target *-*-* } .-1 } |
| 28 |
|
| 29 |
void f3_x2 (int, A1[n], A2[n], A3[n]); |
| 30 |
// { dg-note "previously declared as 'A2\\\[n]'" "note" { target *-*-* } .-1 } |
| 31 |
void f3_x2 (int, A1[n], A2[n2], A3[n]); |
| 32 |
// { dg-warning "argument 3 of type 'A2\\\[n2]' declared with mismatched bound 'n2'" "" { target *-*-* } .-1 } |
| 33 |
|
| 34 |
void f3_x3 (int, A1[n], A2[n], A3[n]); |
| 35 |
// { dg-note "previously declared as 'A3\\\[n]'" "note" { target *-*-* } .-1 } |
| 36 |
void f3_x3 (int, A1[n], A2[n], A3[n3]); |
| 37 |
// { dg-warning "argument 4 of type 'A3\\\[n3]' declared with mismatched bound 'n3'" "" { target *-*-* } .-1 } |
| 38 |
|
| 39 |
|
| 40 |
void g3_x1 (int, A1[n], A2[*], A3[n]); |
| 41 |
// { dg-note "previously declared as 'A1\\\[n]'" "note" { target *-*-* } .-1 } |
| 42 |
void g3_x1 (int, A1[n1], A2[*], A3[n]); |
| 43 |
// { dg-warning "argument 2 of type 'A1\\\[n1]' declared with mismatched bound 'n1'" "" { target *-*-* } .-1 } |
| 44 |
|
| 45 |
void g3_x2 (int, A1[*], A2[n], A3[n]); |
| 46 |
// { dg-note "previously declared as 'A2\\\[n]'" "note" { target *-*-* } .-1 } |
| 47 |
void g3_x2 (int, A1[*], A2[n2], A3[n]); |
| 48 |
// { dg-warning "argument 3 of type 'A2\\\[n2]' declared with mismatched bound 'n2'" "" { target *-*-* } .-1 } |
| 49 |
|
| 50 |
void g3_x3 (int, A1[*], A2[*], A3[n]); |
| 51 |
// { dg-note "previously declared as 'A3\\\[n]'" "note" { target *-*-* } .-1 } |
| 52 |
void g3_x3 (int, A1[*], A2[*], A3[n3]); |
| 53 |
// { dg-warning "argument 4 of type 'A3\\\[n3]' declared with mismatched bound 'n3'" "" { target *-*-* } .-1 } |
| 54 |
|
| 55 |
|
| 56 |
void h3_x1 (int, A1[n], A2[ ], A3[n]); |
| 57 |
// { dg-note "previously declared as 'A1\\\[n]'" "note" { target *-*-* } .-1 } |
| 58 |
void h3_x1 (int, A1[n1], A2[ ], A3[n]); |
| 59 |
// { dg-warning "argument 2 of type 'A1\\\[n1]' declared with mismatched bound 'n1'" "" { target *-*-* } .-1 } |
| 60 |
|
| 61 |
void h3_x2 (int, A1[ ], A2[n], A3[n]); |
| 62 |
// { dg-note "previously declared as 'A2\\\[n]'" "note" { target *-*-* } .-1 } |
| 63 |
void h3_x2 (int, A1[ ], A2[n2], A3[n]); |
| 64 |
// { dg-warning "argument 3 of type 'A2\\\[n2]' declared with mismatched bound 'n2'" "" { target *-*-* } .-1 } |
| 65 |
|
| 66 |
void h3_x3 (int, A1[ ], A2[ ], A3[n]); |
| 67 |
// { dg-note "previously declared as 'A3\\\[n]'" "note" { target *-*-* } .-1 } |
| 68 |
void h3_x3 (int, A1[ ], A2[ ], A3[n3]); |
| 69 |
// { dg-warning "argument 4 of type 'A3\\\[n3]' declared with mismatched bound 'n3'" "" { target *-*-* } .-1 } |
| 70 |
|