PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / cdce1.c
blobb23ad6371126425e77e8128c25caf7e0840bc098
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" } */
3 /* { dg-require-effective-target int32plus } */
4 /* { dg-final { scan-tree-dump "cdce1.c:16: .* function call is shrink-wrapped into error conditions\." "cdce" } } */
5 /* { dg-require-effective-target large_double } */
7 #include <stdlib.h>
8 #include <math.h>
9 #include <errno.h>
10 int total_err_count = 0;
11 double foo_opt (int x, double y) __attribute__((noinline));
12 double foo_opt (int x, double y)
14 double yy = 0;
15 errno = 0;
16 yy = pow (x, y * y);
17 return 0;
20 double foo (int x, double y) __attribute__((noinline));
21 double foo (int x, double y)
23 double yy = 0;
24 errno = 0;
25 yy = pow (x, y * y);
26 return yy;
29 int test (double (*fp)(int x, double y))
31 int i,x;
33 x = 127;
34 for (i = 30; i < 300; i++)
36 fp (x, i);
37 if (errno)
38 total_err_count ++;
41 x = -300;
42 for (i = 100; i < 300; i++)
44 fp (x, i);
45 if (errno)
46 total_err_count ++;
49 x = 65577;
50 for (i = 60; i < 200; i++)
52 fp (x, i);
53 if (errno)
54 total_err_count ++;
57 x = 65577 * 127;
58 for (i = 1; i < 100; i++)
60 fp (x, i);
61 if (errno)
62 total_err_count ++;
65 return total_err_count;
68 int main ()
70 int en1, en2;
71 total_err_count = 0;
72 en1 = test (foo_opt);
73 total_err_count = 0;
74 en2 = test (foo);
76 if (en1 != en2)
77 abort ();
79 return 0;