This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: FWD: FLOATING-POINT CONSISTENCY, -FFLOAT-STORE, AND X86
- To: moshier at mediaone dot net
- Subject: Re: FWD: FLOATING-POINT CONSISTENCY, -FFLOAT-STORE, AND X86
- From: Craig Burley <burley at gnu dot org>
- Date: Wed, 16 Dec 1998 13:13:43 -0500 (EST)
- Cc: bosch at gnat dot com, hjstein at bfr dot co dot il, egcs at cygnus dot com, tprince at cat dot e-mail dot com
- Cc: burley at gnu dot org
>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)