PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / cdce2.c
blob9e6f34467694160b275ad0c247038f18cd872995
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" } } */
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)
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;
31 for (i = -100; i < 100; i++)
33 fp (i);
34 if (errno)
35 total_err_count ++;
38 return total_err_count;
41 int main ()
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);
50 if (en1 != en2)
51 abort();
53 return 0;