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: FWD: FLOATING-POINT CONSISTENCY, -FFLOAT-STORE, AND X86


>If you want to guarantee a value will be written out to memory,
>you can simply declare the memory variable to be "volatile."
>Then the compiler cannot continue to ignore you.  The reason
>this works, and must work on all compilers that optimize, is that
>you would not be able to write hardware device drivers if "volatile"
>did not work.  Software people seem to find this solution unappealing.
>I do not understand why.

Because `volatile' has nothing to do with getting consistent numerical
results.  "Writing to memory" is a meaningless phrase in numerical
programming.  Numerical programmers should not have to worry whether
the compiler places a value in a register, in memory, in a temporary
file, or whatever.  They should be able to just focus on the minimum
precision they need for variables, operations, and so on, and get
consistent behavior from the code generators they use.

If they *don't* get the consistent behavior, they'll use better
code generators that *do* give them consistent behavior.

Further, `volatile' is basically completely useless in getting f(x) < f(y)
to imply that f(y) > f(x), AFAICT.

        tq vm, (burley)


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