summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/20020415-1.c
blob: 7d5b5aebdea1a81c353ec6277a6e1790ff6b12fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* PR target/6303
   This testcase ICEd because s390 did not define
   ASM_SIMPLIFY_DWARF_ADDR hook.  */
/* { dg-do compile { target fpic } } */
/* { dg-options "-O2 -fpic -g" } */

static inline char *
bar (unsigned long x, char *y)
{
  extern const char ext[];
  const char *a = ext;
  char *b = y;

  do *--b = a[x % 10]; while ((x /= 10) != 0);
  return b;
}

struct A { char *p, *q; };
struct B { int r, s; };

int
foo (struct A *a, const struct B *b)
{
  char c[(b->r > b->s) ? b->r : b->s];
  char *d = &c[sizeof c];
  register char *e;

  e = bar (b->r, d);
  while (e < d)
    {
      register const int f = *e++;
      if (((a->p >= a->q) ? 1 : (unsigned char) (*a->p++ = f)) == -1)
	break;
    }
}