1 /* 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
func(double d,int n)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
main()19 int main ()
20 {
21 if (__builtin_copysign (1.0, func (0.0 / -5.0, 10)) != -1.0)
22 abort ();
23 exit (0);
24 }
25