Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / Wvla-parameter-4.c
blobf35faea361a9e6b68d20ce06f24e61e77aad5c01
1 /* PR c/50584 - No warning for passing small array to C99 static array
2 declarator
3 Verify warnings for redeclarations of functions with pointer parameters
4 to arrays with variable bounds involving typedefs.
5 { dg-do compile }
6 { dg-options "-Wall -Wvla-parameter" } */
8 extern int m, n;
10 typedef int IA3[3];
12 /* Verify the warning points to the declaration with more unspecified
13 bounds, guiding the user to specify them rather than making them all
14 unspecified. */
16 void* f_pIA3an (IA3 *x[n]); // { dg-message "previously declared as 'int \\\(\\\*\\\[n]\\\)\\\[3]' with 0 unspecified variable bounds" "note" }
17 void* f_pIA3an (IA3 *x[n]);
18 void* f_pIA3an (IA3 *x[*]); // { dg-warning "argument 1 of type 'int \\\(\\\*\\\[\\\*]\\\)\\\[3]' .aka '\[^\n\r\}\]+'. declared with 1 unspecified variable bound" }
19 void* f_pIA3an (IA3 *x[n]) { return x; }
22 void nowarn_local_fndecl (void)
24 typedef int IAm[m];
26 void* f_IAm (IAm);
27 void* f_IAm (int[m]);
28 void* f_IAm (IAm);
30 void* f_iam (int[m]);
31 void* f_iam (IAm);
32 void* f_iam (int[m]);
34 typedef int IA3[3];
35 typedef IA3 IAn_3[n];
36 typedef IAn_3 IA2_n_3[2];
37 typedef IA2_n_3 IAm_2_n_3[m];
39 void f_IAm_2_n_3 (IAm_2_n_3);
40 void f_IAm_2_n_3 (IA2_n_3[m]);
41 void f_IAm_2_n_3 (IAn_3[m][2]);
42 void f_IAm_2_n_3 (IA3[m][2][n]);
43 void f_IAm_2_n_3 (int[m][2][n][3]);
45 void f_iam_2_n_3 (int[m][2][n][3]);
46 void f_iam_2_n_3 (IA3[m][2][n]);
47 void f_iam_2_n_3 (IAn_3[m][2]);
48 void f_iam_2_n_3 (IAm_2_n_3);
50 void f_IAx_m_2_n_3 (IAm_2_n_3[*]);
51 void f_IAx_m_2_n_3 (IA2_n_3[*][m]);
52 void f_IAx_m_2_n_3 (IAn_3[*][m][2]);
53 void f_IAx_m_2_n_3 (IA3[*][m][2][n]);
54 void f_IAx_m_2_n_3 (int[*][m][2][n][3]);
56 void f_IA__m_2_n_3 (IAm_2_n_3[]);
57 void f_IA__m_2_n_3 (IA2_n_3[][m]);
58 void f_IA__m_2_n_3 (IAn_3[][m][2]);
59 void f_IA__m_2_n_3 (IA3[][m][2][n]);
60 void f_IA__m_2_n_3 (int[][m][2][n][3]);
64 void warn_local_fndecl (void)
66 typedef int IAm[m];
67 typedef int IAn[n];
69 void* g_IAm (IAm); // { dg-message "previously declared as 'int\\\[m]' with bound 'm'" }
70 void* g_IAm (int[n]); // { dg-warning "argument 1 of type 'int\\\[n]' declared with mismatched bound 'n'" }
71 void* g_IAm (IAm);
73 void* g_iam (int[m]); // { dg-message "previously declared as 'int\\\[m]' with bound 'm'" }
74 void* g_iam (IAn); // { dg-warning "argument 1 of type 'int\\\[n]' declared with mismatched bound 'n'" }
75 void* g_iam (int[m]);
78 typedef int IA3[3];
79 typedef IA3 IAn_3[n];
80 typedef IAn_3 IA2_n_3[2];
81 typedef IA2_n_3 IAm_2_n_3[m];
83 typedef IA3 IAm_3[m];
84 typedef IAm_3 IA2_m_3[2];
85 typedef IA2_m_3 IAm_2_m_3[m];
87 void* g_IAm_2_n_3 (IAm_2_n_3);
88 void* g_IAm_2_n_3 (int[m][2][m][3]); // { dg-warning "argument 1 of type 'int\\\[m]\\\[2]\\\[m]\\\[3]' declared with mismatched bound 'm'" }
89 void* g_IAm_2_n_3 (IAm_2_n_3);
91 void* g_iam_2_n_2 (int[m][2][n][3]);
92 void* g_iam_2_n_2 (IAm_2_m_3); // { dg-warning "argument 1 of type 'int\\\[m]\\\[2]\\\[m]\\\[3]' declared with mismatched bound 'm'" }
93 void* g_iam_2_n_2 (int[m][2][n][3]);