]>
Commit | Line | Data |
---|---|---|
359ce95f | 1 | /* { dg-do run } */ |
4f4b0ab8 | 2 | /* { dg-skip-if "doubles are floats" { "avr-*-*" } } */ |
c2699190 | 3 | /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" } */ |
c469078d | 4 | /* { dg-final { scan-tree-dump "cdce2.c:15: note: function call is shrink-wrapped into error conditions\." "cdce" } } */ |
c2699190 | 5 | |
c2699190 XDL |
6 | #include <stdlib.h> |
7 | #include <math.h> | |
8 | #include <errno.h> | |
9 | int total_err_count = 0; | |
10 | double foo_opt (double y) __attribute__((noinline)); | |
11 | double foo_opt (double y) | |
12 | { | |
13 | double yy = 0; | |
14 | errno = 0; | |
15 | yy = log (y); | |
16 | return 0; | |
17 | } | |
18 | ||
19 | double foo (double y) __attribute__((noinline)); | |
20 | double foo (double y) | |
21 | { | |
22 | double yy = 0; | |
23 | errno = 0; | |
24 | yy = log (y); | |
25 | return yy; | |
26 | } | |
27 | ||
28 | int test (double (*fp) (double y)) | |
29 | { | |
30 | int i,x; | |
31 | for (i = -100; i < 100; i++) | |
32 | { | |
33 | fp (i); | |
34 | if (errno) | |
35 | total_err_count ++; | |
36 | } | |
37 | ||
38 | return total_err_count; | |
39 | } | |
40 | ||
41 | int main () | |
42 | { | |
43 | int en1, en2; | |
44 | double yy; | |
45 | total_err_count = 0; | |
46 | en1 = test (foo_opt); | |
47 | total_err_count = 0; | |
48 | en2 = test (foo); | |
49 | ||
50 | if (en1 != en2) | |
51 | abort(); | |
52 | ||
53 | return 0; | |
54 | } |