1 /* PR middle-end/70025 */
2 /* { dg-do run } */
3 /* { dg-additional-options "-mtune=z10" { target s390*-*-* } } */
4 /* { dg-require-effective-target int32plus } */
5 
6 typedef char (*F) (unsigned long, void *);
7 typedef union { struct A { char a1, a2, a3, a4; unsigned long a5; F a6; void *a7; } b; char c[1]; } B;
8 struct C { const char *c1; unsigned long c2; };
9 typedef struct D { unsigned long d1; int d2; const char *d3; unsigned long d4, d5; struct C d6[49]; char d7[8]; } E[1];
10 
11 __attribute__ ((noinline, noclone))
foo(register E p)12 void foo (register E p)
13 {
14   asm volatile ("" : : "r" (p) : "memory");
15 }
16 
17 __attribute__ ((noinline, noclone))
bar(register E p)18 void bar (register E p)
19 {
20   register unsigned long k = p[0].d1 + 1;
21   register struct C *l = &p[0].d6[p[0].d2];
22   register const char *m = l->c1;
23   p[0].d1 = k;
24   if (*m == '\0')
25     {
26       register struct A *f = &((B *) m)->b;
27       register unsigned long n = l->c2;
28       register unsigned long o = n + f->a5;
29       if (k < o)
30 	{
31 	  register unsigned long i;
32 	  register unsigned long q = k + 8;
33 	  register F a6 = f->a6;
34 	  register void *a7 = f->a7;
35 	  if (q > o)
36 	    q = o;
37 	  for (i = k; i < q; i++)
38 	    p[0].d7[i - k] = (*a6) (i - n, a7);
39 	  p[0].d4 = k;
40 	  p[0].d3 = p[0].d7;
41 	  p[0].d5 = q;
42 	  return;
43 	}
44     }
45   while (p[0].d2 > 0 && l[0].c2 != l[-1].c2)
46     {
47       p[0].d2--;
48       l--;
49     }
50   if (p[0].d2 == 0)
51     {
52       p[0].d2 = 0x55555555;
53       return;
54     }
55   p[0].d2--;
56   foo (p);
57 }
58 
59 char
baz(unsigned long i,void * j)60 baz (unsigned long i, void *j)
61 {
62   if (j != 0)
63     __builtin_abort ();
64   return (char) i;
65 }
66 
67 int
main()68 main ()
69 {
70   struct D p;
71   struct A f;
72   __builtin_memset (&f, 0, sizeof (f));
73   f.a2 = 4;
74   f.a5 = 13;
75   f.a6 = baz;
76   __builtin_memset (&p, 0, sizeof (p));
77   p.d6[0].c1 = (const char *) &f;
78   bar (&p);
79   if (p.d4 != 1 || p.d5 != 9 || p.d3 != p.d7)
80     __builtin_abort ();
81   return 0;
82 }
83