This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: What is acceptable for -ffast-math? (Was: associative law in combine)


dewar@gnat.com writes:

| <<The C/C++ Standard, for example, say that a/b/c is evaluated as
| (a/b)/c. Someone proposed that it should be evaluated as a/(b*c)
| -- which of course is incorrect -- when optimizing.
| >>
| 
| Well now, let's be a little careful here ....
| 
| When the C standard says a/b/c is evaluated as (a/b)/c, it means that the
| result is *as if* it were computed that way, and a compiler is of course
| free to compute a/(b*c) if the result is still correct.

Completely agreed.

[...]

| So the "which of course is incorrect" is a bit too glib here.

What I intended to mean is that the compiler has, first, to prove that
such transformmation yields the same result.  The only argument I've
seen so far is that, GCC should make the program run fast...

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]