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

--- Comment #5 from jgreenhalgh at gcc dot gnu.org ---
I've seen similar behavior on an HPC benchmark I was looking at.

The problem here is the interaction between fold-const.c, other passes, and
-fmath-errno.

Take this testcase:

void
foo (double x)
{
  x * x;
}

fold-const.c is going to see x *x and canonicalize it to a call to pow. No
other pass will want to touch it, because now it could set errno, so we get as
code generation:

foo:
    fmov    d1, 2.0e+0
    b    pow


If we add -fno-math-errno :

foo:
    ret

When I looked at this before I convinced myself that fold-const.c shouldn't be
doing the canonicalization to pow if we cared about errno - but I never spun a
patch for it - and I'm not sure I'm right.

Reply via email to