FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-3.c
blob49bea5e126e90ee65f970ebf4f82b92a4efaab1c
1 /* Copyright (C) 2002 Free Software Foundation.
3 Verify that built-in math function constant folding of constant
4 arguments is correctly performed by the by the compiler.
6 Written by Roger Sayle, 16th August 2002. */
8 /* { dg-do link } */
9 /* { dg-options "-O2 -ffast-math" } */
11 extern void link_error(void);
13 int main()
15 if (sqrt (0.0) != 0.0)
16 link_error ();
18 if (sqrt (1.0) != 1.0)
19 link_error ();
21 if (exp (0.0) != 1.0)
22 link_error ();
24 if (log (1.0) != 0.0)
25 link_error ();
28 if (sqrtf (0.0f) != 0.0f)
29 link_error ();
31 if (sqrtf (1.0f) != 1.0f)
32 link_error ();
34 if (expf (0.0f) != 1.0f)
35 link_error ();
37 if (logf (1.0f) != 0.0f)
38 link_error ();
41 if (sqrtl (0.0l) != 0.0l)
42 link_error ();
44 if (sqrtl (1.0l) != 1.0l)
45 link_error ();
47 if (expl (0.0l) != 1.0l)
48 link_error ();
50 if (logl (1.0l) != 0.0l)
51 link_error ();
53 return 0;