OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [ieee/] [mzero6.c] - Blame information for rev 688

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* Tail call optimizations would convert func() into the moral equivalent of:
2
 
3
       double acc = 0.0;
4
       for (int i = 0; i <= n; i++)
5
         acc += d;
6
       return acc;
7
 
8
   which mishandles the case where 'd' is -0.  They also initialised 'acc'
9
   to a zero int rather than a zero double.  */
10
 
11
double func (double d, int n)
12
{
13
  if (n == 0)
14
    return d;
15
  else
16
    return d + func (d, n - 1);
17
}
18
 
19
int main ()
20
{
21
  if (__builtin_copysign (1.0, func (0.0 / -5.0, 10)) != -1.0)
22
    abort ();
23
  exit (0);
24
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.