1 /* PR c/99420 - bogus -Warray-parameter on a function redeclaration
2 in function scope
3 { dg-do compile }
4 { dg-options "-Wall" } */
5
6 extern int a1[1], a2[2], a3[3], a4[4];
7
8 void fa1 (int [1]); // { dg-message "previously declared as 'int\\\[1]'" }
9 void fa1 (int [1]);
10
11
12 void nested_decl (void)
13 {
14 void fa2 (int [2]);
15
16 fa2 (a1); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
17 fa2 (a2);
18 fa2 (a3);
19
20 void fa3 (int [3]);
21
22 fa3 (a2); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
23 fa3 (a3);
24 }
25
26
27 void nested_redecl (void)
28 {
29 void fa1 (int [2]); // { dg-warning "argument 1 of type 'int\\\[2]' with mismatched bound" }
30
31 fa1 (a1 + 1); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
32 fa1 (a1);
33
34 void fa2 (int [2]); // { dg-bogus "\\\[-Warray-parameter" }
35
36 fa2 (a1); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
37 fa2 (a2);
38 fa2 (a3);
39
40 void fa3 (int [3]); // { dg-bogus "\\\[-Warray-parameter" }
41
42 fa3 (a2); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
43 fa3 (a3);
44
45 void fa4 (int [4]);
46 }
47
48 void fa4 (int [5]); // { dg-warning "\\\[-Warray-parameter" }
49
50 void call_fa4 (void)
51 {
52 fa4 (a4);
53 fa4 (a3); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overflow" }
54 }