libgcc/:
[official-gcc.git] / gcc / testsuite / gcc.dg / split-8.c
blob33662e24c4f8928d0d61a9e3c713bc3af37872d4
1 /* { dg-do run } */
2 /* { dg-require-effective-target split_stack } */
3 /* { dg-options "-fsplit-stack" } */
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(). */
8 #include <stdlib.h>
10 double gd[8];
11 int z;
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));
18 double bar(double q)
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];
26 double foo(double d)
28 return bar(d);
31 int ck(double d)
33 if (d != 64.0)
34 abort();
35 return 0;
38 typedef double (*fp)(double);
39 fp g = foo;
41 int main(int argc, char **argv) {
42 return ck(g(64.0));