2007-05-23 H.J. Lu <hongjiu.lu@intel.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / 20000807-1.c
blob70b0182b05407edd615990daeb1b44e30a1311b5
1 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
2 /* { dg-require-effective-target fpic } */
3 /* { dg-options "-Os -fpic" } */
5 #include <string.h>
7 typedef struct
9 char *a;
10 char *b;
11 } *foo;
13 void
14 bar (foo x)
16 char *c = x->b;
17 char *d = (void *)0;
18 unsigned int e = 0, f = 0, g;
19 while (*c != ':')
20 if (*c == '%')
22 ++c;
23 switch (*c++)
25 case 'N':
26 g = strlen (x->a);
27 if (e + g >= f) {
28 char *h = d;
29 f += 256 + g;
30 d = (char *) __builtin_alloca (f);
31 memcpy (d, h, e);
33 memcpy (&d[e], x->a, g);
34 e += g;
35 break;