Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / cdce1.c
blobe7d2ca7403a493026d795d8d97b4a7081d008ba0
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -fdump-tree-optimized -lm" } */
3 /* { dg-require-effective-target int32plus } */
4 /* { dg-require-effective-target large_double } */
5 /* { dg-final { scan-tree-dump "cdce1.c:17: \[^\n\r]* function call is shrink-wrapped into error conditions\." "cdce" } } */
6 /* { dg-final { scan-tree-dump "pow \\(\[^\n\r]*\\); \\\[tail call\\\]" "optimized" } } */
8 #include <stdlib.h>
9 #include <math.h>
10 #include <errno.h>
11 int total_err_count = 0;
12 double foo_opt (int x, double y) __attribute__((noinline));
13 double foo_opt (int x, double y)
15 double yy = 0;
16 errno = 0;
17 yy = pow (x, y * y);
18 return 0;
21 double foo (int x, double y) __attribute__((noinline));
22 double foo (int x, double y)
24 double yy = 0;
25 errno = 0;
26 yy = pow (x, y * y);
27 return yy;
30 int test (double (*fp)(int x, double y))
32 int i,x;
34 x = 127;
35 for (i = 30; i < 300; i++)
37 fp (x, i);
38 if (errno)
39 total_err_count ++;
42 x = -300;
43 for (i = 100; i < 300; i++)
45 fp (x, i);
46 if (errno)
47 total_err_count ++;
50 x = 65577;
51 for (i = 60; i < 200; i++)
53 fp (x, i);
54 if (errno)
55 total_err_count ++;
58 x = 65577 * 127;
59 for (i = 1; i < 100; i++)
61 fp (x, i);
62 if (errno)
63 total_err_count ++;
66 return total_err_count;
69 int main ()
71 int en1, en2;
72 total_err_count = 0;
73 en1 = test (foo_opt);
74 total_err_count = 0;
75 en2 = test (foo);
77 if (en1 != en2)
78 abort ();
80 return 0;