https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
C testcase for the torture testsuite that also triggers on trunk (which needs
-fno-tree-sink)

/* { dg-do run { target *-*-*gnu* } } */
/* { dg-additional-options "-fno-tree-sink -fno-math-errno -ftree-vectorize
-D_GNU_SOURCE" } */
/* { dg-require-effective-target fenv_exceptions } */

#include <fenv.h>

double a[2];
void __attribute__((noipa)) foo ()
{
  double x = a[0];
  double y = a[1];
  double norm = __builtin_sqrt (x*x + y*y);
  if (norm > 1.)
    {
      x = x / norm;
      y = y / norm;
    }
  a[0] = x;
  a[1] = y;
}

int main()
{
  feenableexcept (FE_INVALID);
  a[0] = 0.;
  a[1] = 0.;
  foo ();
  if (a[0] != 0. || a[1] != 0.)
    __builtin_abort ();
  return 0;
}

Reply via email to