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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
So somehow we not fail to set the const attribute on sin/cos, but fp gets the
const attribute.  In FRE we make the c = fp (a) call direct but fail to
update SSA form because the call now should get a virtual use (well,
technically we should preserve the constness on the call stmt itself like
we do for nothrow/noreturn ...).

So a testcase that exhibits the same issue would be to not use builtins
but instead random other pure functions.

double foo (double) __attribute__ ((pure));
double (*fp) (double) __attribute__ ((const));
double f(double a)
{
  fp = foo;
  return fp (a);
}

which ICEs since GCC 5 with -O.  The ssa-pre-13.c issue now runs into it
because of r262596 ignoring the const attribute.

Reply via email to