[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-7.c
blob13e708e299742c34a6ab12ce0cdda33ec3eb708e
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 double pow (double, double);
12 extern float powf (float, float);
13 extern long double powl (long double, long double);
14 extern double tan (double);
15 extern float tanf (float);
16 extern long double tanl (long double);
17 extern double atan (double);
18 extern float atanf (float);
19 extern long double atanl (long double);
21 extern void link_error(void);
23 void test(double x)
25 if (pow (x, 1.0) != x)
26 link_error ();
27 if (tan (atan (x)) != x)
28 link_error ();
31 void testf(float x)
33 if (powf (x, 1.0f) != x)
34 link_error ();
35 if (tanf (atanf (x)) != x)
36 link_error ();
39 void testl(long double x)
41 if (powl (x, 1.0l) != x)
42 link_error ();
43 if (tanl (atanl (x)) != x)
44 link_error ();
47 int main()
49 test (2.0);
50 testf (2.0f);
51 testl (2.0l);
53 return 0;