1 /* { dg-do run } */
2 /* { dg-require-effective-target split_stack } */
3 /* { dg-options "-fsplit-stack" } */
4
5 /* Testcase for PR86213. On the first call to __morestack there is a live
6 value in xmm0, which was being clobbered by a call to getenv(). */
7
8 #include <stdlib.h>
9
10 double gd[8];
11 int z;
12
13 double bar(double q) __attribute__ ((noinline));
14 double foo(double q) __attribute__ ((noinline));
15 int ck(double q) __attribute__ ((noinline));
16 int main(int argc, char **argv) __attribute__ ((no_split_stack));
17
18 double bar(double q)
19 {
20 double d[8];
21 for (unsigned i = 0; i < 8; ++i)
22 d[i] = gd[8-i-1];
23 return q + d[z&3];
24 }
25
26 double foo(double d)
27 {
28 return bar(d);
29 }
30
31 int ck(double d)
32 {
33 if (d != 64.0)
34 abort();
35 return 0;
36 }
37
38 typedef double (*fp)(double);
39 fp g = foo;
40
41 int main(int argc, char **argv) {
42 return ck(g(64.0));
43 }