annotate gcc/testsuite/gcc.dg/c11-complex-1.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test complex divide does not have the bug identified in N1496. */
kono
parents:
diff changeset
2 /* { dg-do run } */
kono
parents:
diff changeset
3 /* { dg-options "-std=c11 -pedantic-errors" } */
kono
parents:
diff changeset
4 /* { dg-add-options ieee } */
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 extern void abort (void);
kono
parents:
diff changeset
7 extern void exit (int);
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 #define CMPLX(x, y) __builtin_complex ((double) (x), (double) (y))
kono
parents:
diff changeset
10 #define CMPLXF(x, y) __builtin_complex ((float) (x), (float) (y))
kono
parents:
diff changeset
11 #define CMPLXL(x, y) __builtin_complex ((long double) (x), (long double) (y))
kono
parents:
diff changeset
12 #define NAN __builtin_nanf ("")
kono
parents:
diff changeset
13 #define isnan(x) __builtin_isnan (x)
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 volatile _Complex float num_f = CMPLXF (1, 1);
kono
parents:
diff changeset
16 volatile _Complex float den_f = CMPLXF (0, NAN);
kono
parents:
diff changeset
17 volatile _Complex float res_f, cres_f = CMPLXF (1, 1) / CMPLXF (0, NAN);
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 volatile _Complex double num_d = CMPLX (1, 1);
kono
parents:
diff changeset
20 volatile _Complex double den_d = CMPLX (0, NAN);
kono
parents:
diff changeset
21 volatile _Complex double res_d, cres_d = CMPLX (1, 1) / CMPLX (0, NAN);
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 volatile _Complex long double num_ld = CMPLXL (1, 1);
kono
parents:
diff changeset
24 volatile _Complex long double den_ld = CMPLXL (0, NAN);
kono
parents:
diff changeset
25 volatile _Complex long double res_ld, cres_ld = CMPLXL (1, 1) / CMPLXL (0, NAN);
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 int
kono
parents:
diff changeset
28 main (void)
kono
parents:
diff changeset
29 {
kono
parents:
diff changeset
30 res_f = num_f / den_f;
kono
parents:
diff changeset
31 if (!isnan (__real__ res_f) || !isnan (__imag__ res_f)
kono
parents:
diff changeset
32 || !isnan (__real__ cres_f) || !isnan (__imag__ cres_f))
kono
parents:
diff changeset
33 abort ();
kono
parents:
diff changeset
34 res_d = num_d / den_d;
kono
parents:
diff changeset
35 if (!isnan (__real__ res_d) || !isnan (__imag__ res_d)
kono
parents:
diff changeset
36 || !isnan (__real__ cres_d) || !isnan (__imag__ cres_d))
kono
parents:
diff changeset
37 abort ();
kono
parents:
diff changeset
38 res_ld = num_ld / den_ld;
kono
parents:
diff changeset
39 if (!isnan (__real__ res_ld) || !isnan (__imag__ res_ld)
kono
parents:
diff changeset
40 || !isnan (__real__ cres_ld) || !isnan (__imag__ cres_ld))
kono
parents:
diff changeset
41 abort ();
kono
parents:
diff changeset
42 exit (0);
kono
parents:
diff changeset
43 }