Debian Codegraph @

gcc/testsuite/gcc.dg/Warray-parameter-11.c

raw
1 /* PR c/101702 - ICE on invalid function redeclaration
2 { dg-do compile }
3 { dg-options "-Wall" } */
4
5 typedef __INTPTR_TYPE__ intptr_t;
6
7 #define copysign(x, y) __builtin_copysign (x, y)
8
9 void f0 (double[!copysign (~2, 3)]);
10
11 void f1 (double[!copysign (~2, 3)]);
12 void f1 (double[1]); // { dg-warning "-Warray-parameter" }
13
14 void f2 (int[(int)+1.0]);
15 void f2 (int[(int)+1.1]);
16
17 /* Also verify that equivalent expressions don't needlessly cause false
18 positives or negatives. */
19 struct S { int a[1]; };
20 extern struct S *sp;
21
22 void f3 (int[(intptr_t)((char*)sp->a - (char*)sp)]);
23 void f3 (int[(intptr_t)((char*)&sp->a[0] - (char*)sp)]);
24 void f3 (int[(intptr_t)((char*)&sp->a[1] - (char*)sp)]); // { dg-warning "-Warray-parameter" }