Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / vla-13.c
blob70b63059d722fa43f0bee05f77cca909929d6fa6
1 /* Test for VLA size evaluation; see PR 35198. */
2 /* Origin: Joseph Myers <joseph@codesourcery.com> */
3 /* { dg-do run } */
4 /* { dg-options "-std=c99" } */
6 extern void exit (int);
7 extern void abort (void);
9 int i;
10 void *p;
12 void
13 f1 (void *x, int j)
15 p = (int (*)[++i])x;
16 if (i != j)
17 abort ();
20 void
21 f1c (void *x, int j)
23 p = (int (*)[++i]){x};
24 if (i != j)
25 abort ();
28 void
29 f2 (void *x, int j)
31 x = (void *)(int (*)[++i])p;
32 if (i != j)
33 abort ();
36 void
37 f2c (void *x, int j)
39 x = (void *)(int (*)[++i]){p};
40 if (i != j)
41 abort ();
44 void
45 f3 (void *x, int j)
47 (void)(int (*)[++i])p;
48 if (i != j)
49 abort ();
52 void
53 f3c (void *x, int j)
55 (void)(int (*)[++i]){p};
56 if (i != j)
57 abort ();
60 void
61 f4 (void *x, int j)
63 (int (*)[++i])p;
64 (int (*)[++i])p;
65 if (i != j)
66 abort ();
69 void
70 f4c (void *x, int j)
72 (int (*)[++i]){p};
73 (int (*)[++i]){p};
74 if (i != j)
75 abort ();
78 void
79 f5c (void *x, int j, int k)
81 (++i, f3c (x, j), (int (*)[++i]){p});
82 if (i != k)
83 abort ();
86 int
87 main (void)
89 f1 (p, 1);
90 f2 (p, 2);
91 f3 (p, 3);
92 f4 (p, 5);
93 f1c (p, 6);
94 f2c (p, 7);
95 f3c (p, 8);
96 f4c (p, 10);
97 f5c (p, 12, 13);
98 exit (0);