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

--- Comment #10 from Martin Jambor <jamborm at gcc dot gnu.org> ---
This is an equivalent testcase without OpenMP and especially without iostream,
making dump reading a bit easier:

using complex_t = double __complex__;
struct A {
    complex_t value;
    A(double r) : value{r, 0} {}
};

void __attribute__((noipa))
int_sink (const int x)
{
  if (x != 0)
    __builtin_abort ();
  return;
}

void __attribute__((noipa))
double_sink (const double x)
{
  if (x < 0.1)
    __builtin_abort ();
  return;
}

void
test (const complex_t &c, const int &x)
{
  if (x < 0)
    int_sink (x+2*x+3*x+4*x+5*x);
  else
    {
      double r = __real__ c;
      double_sink (r);
    }
}

volatile int vc = 1;

int main() {
  for (int i = 0; i < vc; i++)
    {
      A a{0.123};
      test(a.value, 123);
    }
    return 0;
}

Reply via email to