Check in tree-dce enh to trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / cdce1.c
blob8e29fc4979cff89d082e9707c72f5f3fe5a54295
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fdump-tree-dce1-details -lm" } */
3 /* { dg-message "note: function call is shrink-wrapped into error conditions\." "Missing conditional dce" {target "*-*-*"} 15 } */
5 #include <stdlib.h>
6 #include <math.h>
7 #include <errno.h>
8 #include <stdio.h>
9 int total_err_count = 0;
10 double foo_opt(int x, double y) __attribute__((noinline));
11 double foo_opt(int x, double y)
13 double yy = 0;
14 errno = 0;
15 yy = pow(x,y);
16 return 0;
19 double foo(int x, double y) __attribute__((noinline));
20 double foo(int x, double y)
22 double yy = 0;
23 errno = 0;
24 yy = pow(x,y);
25 return yy;
28 int test(double (*fp)(int x, double y))
30 int i,x;
32 x = 127;
33 for (i = 30; i < 300; i++)
35 fp(x,i);
36 if (errno)
37 total_err_count ++;
40 x = -300;
41 for (i = 100; i < 300; i++)
43 fp(x,i);
44 if (errno)
45 total_err_count ++;
48 x = 65577;
49 for (i = 60; i < 200; i++)
51 fp(x,i);
52 if (errno)
53 total_err_count ++;
56 x = 65577*127;
57 for (i = 1; i < 100; i++)
59 fp(x,i);
60 if (errno)
61 total_err_count ++;
64 return total_err_count;
67 int main()
69 int en1, en2;
70 total_err_count = 0;
71 en1 = test(foo_opt);
72 total_err_count = 0;
73 en2 = test(foo);
75 printf("total number of errors = %d, %d\n", en1, en2);
76 if (en1 != en2)
77 abort();
79 return 0;