2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-7.c
blob87995a4d3a0da8ff76a93778cfedebe775a88540
1 /* Copyright (C) 2003 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, 30th March 2003. */
8 /* { dg-do link } */
9 /* { dg-options "-O2 -ffast-math" } */
11 extern void link_error(void);
13 void test(double x)
15 if (pow (x, 1.0) != x)
16 link_error ();
17 if (tan (atan (x)) != x)
18 link_error ();
21 void testf(float x)
23 if (powf (x, 1.0f) != x)
24 link_error ();
25 if (tanf (atanf (x)) != x)
26 link_error ();
29 void testl(long double x)
31 if (powl (x, 1.0l) != x)
32 link_error ();
33 if (tanl (atanl (x)) != x)
34 link_error ();
37 int main()
39 test (2.0);
40 testf (2.0f);
41 testl (2.0l);
43 return 0;