1 /* PR middle-end/33088 */
2 /* Origin: Joseph S. Myers <jsm28@gcc.gnu.org> */
3
4 /* { dg-do run { target i?86-*-linux* i?86-*-gnu* x86_64-*-linux* } } */
5 /* { dg-options "-std=c99 -O -ffloat-store -lm" } */
6
7 #include <fenv.h>
8 #include <stdlib.h>
9
10 volatile int x[1024];
11
12 void __attribute__((noinline))
fill_stack(void)13 fill_stack (void)
14 {
15 volatile int y[1024];
16 int i;
17 for (i = 0; i < 1024; i++)
18 y[i] = 0x7ff00000;
19 for (i = 0; i < 1024; i++)
20 x[i] = y[i];
21 }
22
23 volatile _Complex double vc;
24
25 void __attribute__((noinline))
use_complex(_Complex double c)26 use_complex (_Complex double c)
27 {
28 vc = c;
29 }
30
31 double t0, t1, t2, t3;
32
33 #define USE_COMPLEX(X, R, C) \
34 do { __real__ X = R; __imag__ X = C; use_complex (X); } while (0)
35
36 void __attribute__((noinline))
use_stack(void)37 use_stack (void)
38 {
39 _Complex double a, b, c, d;
40 USE_COMPLEX (a, t0, t1);
41 USE_COMPLEX (b, t1, t2);
42 USE_COMPLEX (c, t2, t3);
43 USE_COMPLEX (d, t3, t0);
44 }
45
46 int
main(void)47 main (void)
48 {
49 fill_stack ();
50 feclearexcept (FE_INVALID);
51 use_stack ();
52 if (fetestexcept (FE_INVALID))
53 abort ();
54 exit (0);
55 }
56