OSDN Git Service

* fold-const.c (fold <ABS_EXPR>): Re-fold the result of folding
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtins-19.c
1 /* Copyright (C) 2003  Free Software Foundation.
2
3    Check that cabs of a non-complex argument is converted into fabs.
4
5    Written by Roger Sayle, 1st June 2003.  */
6
7 /* { dg-do link } */
8 /* { dg-options "-O2 -ansi" } */
9
10 double cabs (__complex__ double);
11 float cabsf (__complex__ float);
12 long double cabsl (__complex__ long double);
13
14 void link_error (void);
15
16 void test (double x)
17 {
18   if (cabs (x) != fabs (x))
19     link_error ();
20 }
21
22 void testf (float x)
23 {
24   if (cabsf (x) != fabsf (x))
25     link_error ();
26 }
27
28 void testl (long double x)
29 {
30   if (cabsl (x) != fabsl (x))
31     link_error ();
32 }
33
34 int main ()
35 {
36   test (1.0);
37   testf (1.0f);
38   testl (1.0l);
39   return 0;
40 }
41