Fortran: fix ALLOCATE with SOURCE of deferred character length [PR114019]
[official-gcc.git] / gcc / testsuite / gcc.dg / pr51990-2.c
blob702bab91357b4ad0009f5e7775ea7c3125427a8e
1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3 /* { dg-require-effective-target alloca } */
5 int y;
6 extern int foo (int, ...) __attribute__((pure));
8 int
9 zzz (char *s1, char *s2, int len, int *q, int c)
11 int z = 5;
12 unsigned int i, b;
13 struct s { char a[z]; };
14 struct s x;
15 int y_tmp = 5;
17 for (i = 0; i < len; i++)
18 s1[i] = s2[i];
20 b = z & 0x3;
22 len += (b == 0 ? 0 : 1) + z;
24 *q = len;
26 if (c)
27 y_tmp = foo (z, x, x) + 4;
29 z = foo (z, x, x) + 4;
30 y = y_tmp;
32 return z;