modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/ieee/mzero6.c (about)

     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  
    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  }