Fix ICE in substring-handling building 502.gcc_r (PR 87562)
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-27.c
blob69d8f994481c3a4256e38985c30edaf4ac22755c
1 /* Copyright (C) 2003 Free Software Foundation.
3 Check that constant folding of built-in math functions doesn't
4 break anything and produces the expected results.
6 Written by Roger Sayle, 29th July 2003. */
8 /* { dg-do link } */
9 /* { dg-options "-O2 -ffast-math" } */
11 extern void link_error(void);
13 extern double pow(double,double);
15 void test(double x)
17 if (pow(x,2.0) != x*x)
18 link_error ();
20 if (x*pow(x,2.0) != pow(x,3.0))
21 link_error ();
23 if (pow(x,2.0)*x != pow(x,3.0))
24 link_error ();
26 if (pow(x,3.0) != x*x*x)
27 link_error ();
29 if (pow(x,2.0)*x != x*x*x)
30 link_error ();
32 if (x*pow(x,2.0) != x*x*x)
33 link_error ();
35 if (pow(x,3.0)/x != pow(x,2.0))
36 link_error ();
38 if (pow(x,3.0)/x != x*x)
39 link_error ();
42 int main()
44 test (2.0);
45 return 0;