OSDN Git Service

* gcc.dg/20020415-1.c: Expect warning for unsupported -fpic on
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / 20020415-1.c
1 /* PR target/6303
2    This testcase ICEd because s390 did not define
3    ASM_SIMPLIFY_DWARF_ADDR hook.  */
4 /* { dg-do compile } */
5 /* { dg-options "-O2 -fpic -g" } */
6 /* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* mmix-*-* } 0 } */
7
8 static inline char *
9 bar (unsigned long x, char *y)
10 {
11   extern const char ext[];
12   const char *a = ext;
13   char *b = y;
14
15   do *--b = a[x % 10]; while ((x /= 10) != 0);
16   return b;
17 }
18
19 struct A { char *p, *q; };
20 struct B { int r, s; };
21
22 int
23 foo (struct A *a, const struct B *b)
24 {
25   char c[(b->r > b->s) ? b->r : b->s];
26   char *d = &c[sizeof c];
27   register char *e;
28
29   e = bar (b->r, d);
30   while (e < d)
31     {
32       register const int f = *e++;
33       if (((a->p >= a->q) ? 1 : (unsigned char) (*a->p++ = f)) == -1)
34         break;
35     }
36 }