PR other/25028
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-54.c
blob29cdf20663def652fe3dbfc3a573057f6740bfc0
1 /* { dg-do link } */
2 /* { dg-options "-O2 -ffast-math" } */
4 double cabs(__complex__ double);
5 float cabsf(__complex__ float);
6 long double cabsl(__complex__ long double);
8 void link_error (void);
10 void test(__complex__ double x)
12 if (cabs(x) != cabs(-x))
13 link_error();
15 if (cabs(x) != cabs(~x))
16 link_error();
19 void testf(__complex__ float x)
21 if (cabsf(x) != cabsf(-x))
22 link_error();
24 if (cabsf(x) != cabsf(~x))
25 link_error();
28 void testl(__complex__ long double x)
30 if (cabsl(x) != cabsl(-x))
31 link_error();
33 if (cabsl(x) != cabsl(~x))
34 link_error();
37 int main()
39 test(0.0);
40 testf(0.0);
41 testl(0.0);
42 return 0;