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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-03-16
                 CC|                            |jsm28 at gcc dot gnu.org
            Version|unknown                     |5.2.0
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  The issue seems to be that you add the optimize attribute after
the function definition.

This causes .original to be already

;; Function foo1 (null)
;; enabled by -tree-original


{
  double s = h + 1.0e+0;

    double s = h + 1.0e+0;
  return ((h - s) + l) + 1.0e+0;
}

which is probably an artifact of fully delayed folding.

The optimize attribute is still applied in the end but too late.

Workaround is to put

double foo1(double h, double l)
__attribute__((optimize("no-associative-math")));

before the definition.

Reply via email to