2017-09-26 Thomas Koenig <tkoenig@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / complex-5.c
blobffedefea36000a44c4fb1dbf97b59c801bfe61c9
1 /* PR middle-end/33088 */
2 /* Origin: Joseph S. Myers <jsm28@gcc.gnu.org> */
4 /* { dg-do run { target i?86-*-linux* i?86-*-gnu* x86_64-*-linux* } } */
5 /* { dg-options "-std=c99 -O -ffloat-store -lm" } */
7 #include <fenv.h>
8 #include <stdlib.h>
10 volatile int x[1024];
12 void __attribute__((noinline))
13 fill_stack (void)
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];
23 volatile _Complex double vc;
25 void __attribute__((noinline))
26 use_complex (_Complex double c)
28 vc = c;
31 double t0, t1, t2, t3;
33 #define USE_COMPLEX(X, R, C) \
34 do { __real__ X = R; __imag__ X = C; use_complex (X); } while (0)
36 void __attribute__((noinline))
37 use_stack (void)
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);
46 int
47 main (void)
49 fill_stack ();
50 feclearexcept (FE_INVALID);
51 use_stack ();
52 if (fetestexcept (FE_INVALID))
53 abort ();
54 exit (0);