https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70255
--- Comment #7 from shatz at dsit dot co.il --- (In reply to Richard Biener from comment #1) > 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. Thank you for the tip.