Check in tree-dce enh to trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / cdce2.c
blob8761872ad1fa79423d6ddd3850fa0b3afcacc7a4
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(double y) __attribute__((noinline));
11 double foo_opt(double y)
13 double yy = 0;
14 errno = 0;
15 yy = log(y);
16 return 0;
19 double foo(double y) __attribute__((noinline));
20 double foo(double y)
22 double yy = 0;
23 errno = 0;
24 yy = log(y);
25 return yy;
28 int test(double (*fp)(double y) )
30 int i,x;
32 for (i = -100; i < 100; i++)
34 fp(i);
35 if (errno)
36 total_err_count ++;
39 return total_err_count;
42 int main()
44 int en1, en2;
45 double yy;
46 total_err_count = 0;
47 en1 = test(foo_opt);
48 total_err_count = 0;
49 en2 = test(foo);
51 if (en1 != en2)
52 abort();
54 return 0;