OSDN Git Service

* gcc.target/i386/20000609-1.c, gcc.target/i386/20000614-1.c,
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / i386 / 20000807-1.c
1 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
2 /* { dg-options "-Os -fpic" } */
3
4 #include <string.h>
5
6 typedef struct
7 {
8   char *a;
9   char *b;
10 } *foo;
11
12 void
13 bar (foo x)
14 {
15   char *c = x->b;
16   char *d = (void *)0;
17   unsigned int e = 0, f = 0, g;
18   while (*c != ':')
19     if (*c == '%')
20       {
21         ++c;
22         switch (*c++)
23           {
24           case 'N':
25             g = strlen (x->a);
26             if (e + g >= f) {
27                 char *h = d;
28                 f += 256 + g;
29                 d = (char *) __builtin_alloca (f);
30                 memcpy (d, h, e);
31             };
32             memcpy (&d[e], x->a, g);
33             e += g;
34             break;
35           }
36       }
37 }