2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr23818.c
blobbe0bb9a010197b7574b7ad1bfa6a50d070647f63
1 /* PR tree-optimization/23818 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -fno-tree-dominator-opts" } */
5 #include <stdarg.h>
7 extern void abort (void);
9 void
10 foo (int p[100], int k, ...)
12 int j, *q;
13 va_list ap;
15 va_start (ap, k);
16 q = va_arg (ap, int *);
17 for (j = 0; j < 100; j++)
18 q[j] = p[j] + 10;
19 va_end(ap);
22 int
23 main (void)
25 int buf[100], buf2[100], i;
26 for (i = 0; i < 100; i++)
27 buf[i] = i + 1;
28 foo (buf, 0, buf2);
29 for (i = 0; i < 100; i++)
30 if (buf2[i] != buf[i] + 10)
31 abort ();
32 return 0;