1 /* { dg-do run } */
2 /* { dg-options "-fPIC" { target fpic } } */
3 __attribute__ ((noinline, noclone)) int
bar(int flag,const char * __restrict format,...)4 bar (int flag, const char *__restrict format, ...)
5 {
6   asm volatile ("" : : "r" (flag), "r" (format) : "memory");
7   return 0;
8 }
9 
10 extern inline __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) int
baz(const char * __restrict fmt,...)11 baz (const char *__restrict fmt, ...)
12 {
13   return bar (1, fmt, __builtin_va_arg_pack ());
14 }
15 
16 __attribute__ ((noinline, noclone)) int
f1(void ** a,const char * b,int * c)17 f1 (void **a, const char *b, int *c)
18 {
19   *a = 0;
20   *c = 0;
21   asm volatile ("" : : "r" (&a), "r" (b), "r" (&c) : "memory");
22   return 0;
23 }
24 
25 __attribute__ ((noinline, noclone)) int
f2(void * a,int b,int c,long d[],int * e)26 f2 (void *a, int b, int c, long d[], int *e)
27 {
28   asm volatile ("" : : "r" (a), "r" (b), "r" (c), "r" (d), "r" (e) : "memory");
29   return 1;
30 }
31 
32 __attribute__ ((noinline, noclone)) int
f3(void * a,int * b)33 f3 (void *a, int *b)
34 {
35   asm volatile ("" : : "r" (a), "r" (b) : "memory");
36   return 0;
37 }
38 
39 __attribute__ ((noinline, noclone)) int
f4(void * a,const char * b,int c,int d,double * e,int f,char ** g,int * h)40 f4 (void *a, const char *b, int c, int d, double *e, int f, char **g, int *h)
41 {
42   asm volatile ("" : : "r" (a), "r" (b), "r" (c), "r" (d) : "memory");
43   asm volatile ("" : : "r" (e), "r" (f), "r" (g), "r" (h) : "memory");
44   return 0;
45 }
46 
47 __attribute__ ((noinline, noclone)) int
f5(void * a,long long b,int c,char ** d,char ** e,char ** f,const char * g,long long h,int * i)48 f5 (void *a, long long b, int c, char **d, char **e, char **f, const char *g, long long h, int *i)
49 {
50   asm volatile ("" : : "r" (a), "r" (b), "r" (c), "r" (d) : "memory");
51   asm volatile ("" : : "r" (e), "r" (f), "r" (g), "r" (h) : "memory");
52   asm volatile ("" : : "r" (i) : "memory");
53   return 0;
54 }
55 
56 __attribute__ ((noinline, noclone)) int
f6(void * a,int b,int * c,int * d)57 f6 (void *a, int b, int *c, int *d)
58 {
59   asm volatile ("" : : "r" (a), "r" (b), "r" (c), "r" (d) : "memory");
60   return 0;
61 }
62 
63 __attribute__ ((noinline, noclone)) int
f7(void * a,int b,long long c,long long d,long long e,double * f,int * g)64 f7 (void *a, int b, long long c, long long d, long long e, double *f, int *g)
65 {
66   asm volatile ("" : : "r" (a), "r" (b), "r" (c), "r" (d) : "memory");
67   asm volatile ("" : : "r" (e), "r" (f), "r" (g) : "memory");
68   return 0;
69 }
70 
71 __attribute__ ((noinline, noclone)) int
f8(void * a,int b,long long c,long long d,long long e,char * f,const char ** g,int * h,int * i)72 f8 (void *a, int b, long long c, long long d, long long e, char *f, const char **g, int *h, int *i)
73 {
74   asm volatile ("" : : "r" (a), "r" (b), "r" (c), "r" (d) : "memory");
75   asm volatile ("" : : "r" (e), "r" (f), "r" (g), "r" (h) : "memory");
76   asm volatile ("" : : "r" (i) : "memory");
77   return 0;
78 }
79 
80 __attribute__ ((noinline, noclone)) int
f9(void * a,int b,long long c,long long d,long long e,char * f,int * g)81 f9 (void *a, int b, long long c, long long d, long long e, char *f, int *g)
82 {
83   asm volatile ("" : : "r" (a), "r" (b), "r" (c), "r" (d) : "memory");
84   asm volatile ("" : : "r" (e), "r" (f), "r" (g) : "memory");
85   return 0;
86 }
87 
88 __attribute__ ((noinline, noclone)) int
f10(void * a,int b,long long c,long long d,long long e,unsigned char f,unsigned char * g,int * h,int * i)89 f10 (void *a, int b, long long c, long long d, long long e, unsigned char f, unsigned char *g, int *h, int *i)
90 {
91   asm volatile ("" : : "r" (a), "r" (b), "r" (c), "r" (d) : "memory");
92   asm volatile ("" : : "r" (e), "r" (f), "r" (g), "r" (h) : "memory");
93   asm volatile ("" : : "r" (i) : "memory");
94   return 0;
95 }
96 
97 __attribute__ ((noinline, noclone)) int
f11(void * a,int b,long long c,long long d,long long e,long f,long * g,int * h,int * i)98 f11 (void *a, int b, long long c, long long d, long long e, long f, long *g, int *h, int *i)
99 {
100   asm volatile ("" : : "r" (a), "r" (b), "r" (c), "r" (d) : "memory");
101   asm volatile ("" : : "r" (e), "r" (f), "r" (g), "r" (h) : "memory");
102   asm volatile ("" : : "r" (i) : "memory");
103   return 0;
104 }
105 
106 __attribute__ ((noinline, noclone)) int
f12(void * a,int b,long long c,long long d,long long e,float f,float * g,int * h,int * i)107 f12 (void *a, int b, long long c, long long d, long long e, float f, float *g, int *h, int *i)
108 {
109   asm volatile ("" : : "r" (a), "r" (b), "r" (c), "r" (d) : "memory");
110   asm volatile ("" : : "r" (e), "r" (f), "r" (g), "r" (h) : "memory");
111   asm volatile ("" : : "r" (i) : "memory");
112   return 0;
113 }
114 
115 __attribute__ ((noinline, noclone)) int
f13(void * a,int b,long long c,long * d,long * e,int * f)116 f13 (void *a, int b, long long c, long *d, long *e, int *f)
117 {
118   asm volatile ("" : : "r" (a), "r" (b), "r" (c), "r" (d) : "memory");
119   asm volatile ("" : : "r" (e), "r" (f) : "memory");
120   return 0;
121 }
122 
123 __attribute__ ((noinline, noclone)) int
f14(void * a,int b,int * c,int * d)124 f14 (void *a, int b, int *c, int *d)
125 {
126   asm volatile ("" : : "r" (a), "r" (b), "r" (c), "r" (d) : "memory");
127   return 0;
128 }
129 
130 volatile int a;
131 
132 int
main()133 main ()
134 {
135   int b, c, d = 0, e, f = 0;
136   long g, h;
137   int j = 0;
138   long k, l;
139   int m;
140   unsigned char n[21];
141   long o[21];
142   float p[21];
143   double q[21];
144   long r[3], s = 0;
145   char t[42];
146   char u[21];
147   char *v[3];
148   const char *w[21];
149   double x[3] = { 15.1515151515151515, 16.1616161616161616, 17.1717171717171717 };
150   char y[40], z[81];
151   void *a2;
152   char *b2[10], *c2[10], *d2[10];
153   char e2[] = "abcdefghijklm";
154   for (g = 0; g < 21; g++)
155     w[g] = "";
156   f1 (&a2, y, &b);
157   if (b)
158     goto lab;
159   c = 32;
160   if (f2 (a2, c, d, r, &b) > 0)
161     __builtin_strcpy (z, "12345678901234567890123478901234567");
162   if (f3 (a2, &b) > 0)
163     goto lab;
164   if (f4 (a2, "abcdefg", 1, j, x, 14, v, &b) > 0)
165     goto lab;
166   for (g = 0; g < a; g++)
167     goto lab;
168   f5 (a2, s, f, b2, c2, d2, e2, 0L, &b);
169   if (f6 (a2, -1, &e, &b) > 0)
170     goto lab;
171   if (b > 0)
172     goto lab;
173   if (f6 (a2, 1, &e, &b) > 0)
174     goto lab;
175   f7 (a2, 8, g, 1, g, q, &b);
176   for (g = 1; g <= 20; g++)
177     {
178       for (h = 0; h < g; h++)
179 	{
180 	  t[h] = 0;
181 	  q[h] = 0;
182 	}
183       f8 (a2, 1, g, 1, 1, u, w, &m, &b);
184       for (h = 0; h < g; h++)
185 	baz (" %2d", t[h]);
186       baz (" %d\nX", b);
187       f9 (a2, 3, g, 1, g, t, &b);
188       for (h = 0; h < g; h++)
189 	baz (" %2d", t[h]);
190       f10 (a2, 4, g, 1, g, 99, n, &m, &b);
191       f11 (a2, 6, g, 1, g, 99, o, &m, &b);
192       f12 (a2, 7, g, 1, g, 99., p, &m, &b);
193       f13 (a2, 8, g, &k, &l, &b);
194     }
195   f14 (a2, 1, &e, &b);
196 lab:
197   return 0;
198 }
199