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

--- Comment #8 from shatz at dsit dot co.il ---
Now a bit of philosophy.

Bugs aside, I should say that use of function attribute optimize() does not
look to me as an ideal solution for forcing ISO rules.
>From theoretical point of view, when we are specifying -Ofast or -ffast-math we
are no longer coding in C, but in programming language that looks like C, but
semantically is more close to Fortran. In this new language a specific grouping
of FP arithmetic ops is by default undefined. So, in this new language, we need
a construct that makes it defined again. Something like built-in function
__iso_order().

So, my test case will look like:
double foo1(double h, double l)
{
  double s = __iso_order(h + 1.0);
  return __iso_order(__iso_order(1.0 - s) + h) + l;
}

It has two advantages
1) Makes an intention of programmer more pronounced, which is always a good
thing
2) provides finer level of control than the whole function.
Because typically when I care about grouping of ops I only care about few
specific statements and don't care about the rest which tends to be a majority
even in a specific function.

Reply via email to