111
|
1 /* { dg-do run } */
|
|
2 /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" } */
|
|
3 /* { dg-require-effective-target int32plus } */
|
131
|
4 /* { dg-final { scan-tree-dump "cdce1.c:16: .* function call is shrink-wrapped into error conditions\." "cdce" } } */
|
111
|
5 /* { dg-require-effective-target large_double } */
|
|
6
|
|
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)
|
|
13 {
|
|
14 double yy = 0;
|
|
15 errno = 0;
|
|
16 yy = pow (x, y * y);
|
|
17 return 0;
|
|
18 }
|
|
19
|
|
20 double foo (int x, double y) __attribute__((noinline));
|
|
21 double foo (int x, double y)
|
|
22 {
|
|
23 double yy = 0;
|
|
24 errno = 0;
|
|
25 yy = pow (x, y * y);
|
|
26 return yy;
|
|
27 }
|
|
28
|
|
29 int test (double (*fp)(int x, double y))
|
|
30 {
|
|
31 int i,x;
|
|
32
|
|
33 x = 127;
|
|
34 for (i = 30; i < 300; i++)
|
|
35 {
|
|
36 fp (x, i);
|
|
37 if (errno)
|
|
38 total_err_count ++;
|
|
39 }
|
|
40
|
|
41 x = -300;
|
|
42 for (i = 100; i < 300; i++)
|
|
43 {
|
|
44 fp (x, i);
|
|
45 if (errno)
|
|
46 total_err_count ++;
|
|
47 }
|
|
48
|
|
49 x = 65577;
|
|
50 for (i = 60; i < 200; i++)
|
|
51 {
|
|
52 fp (x, i);
|
|
53 if (errno)
|
|
54 total_err_count ++;
|
|
55 }
|
|
56
|
|
57 x = 65577 * 127;
|
|
58 for (i = 1; i < 100; i++)
|
|
59 {
|
|
60 fp (x, i);
|
|
61 if (errno)
|
|
62 total_err_count ++;
|
|
63 }
|
|
64
|
|
65 return total_err_count;
|
|
66 }
|
|
67
|
|
68 int main ()
|
|
69 {
|
|
70 int en1, en2;
|
|
71 total_err_count = 0;
|
|
72 en1 = test (foo_opt);
|
|
73 total_err_count = 0;
|
|
74 en2 = test (foo);
|
|
75
|
|
76 if (en1 != en2)
|
|
77 abort ();
|
|
78
|
|
79 return 0;
|
|
80 }
|