Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/cdce2.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* { dg-do run } */ | |
2 /* { dg-skip-if "doubles are floats" { "avr-*-*" } } */ | |
3 /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" } */ | |
4 /* { dg-final { scan-tree-dump "cdce2.c:15: note: function call is shrink-wrapped into error conditions\." "cdce" } } */ | |
5 | |
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 } |