Richard Salz wrote:

> Kyle's claim about things like cache's and registers is wrong, not even
> sort-of right.  The standard talks about only in terms of
> sequence points,
> and volatile limits what can be done in terms of sequence points.  So
>         extern volatile char* p;
>         int i, j;
>         i = *p;
>         j = *p;
> The standard says that the compiler may not treat this as
>         j = i = *p;
>
> *and that's all it says.*

Suppose another thread does this:
*p=99;
*p=98;

Would a compiler that let another code running your code above get 'i' equal
to 98 and 'p' equal to 99 be broken in your opinion? I've seen code
generated on weakly-ordered memory platforms, and memory barriers are not
placed between stores to volatiles.

The problem is that it is not well-defined to talk about the order in which
operations take place. The order can be different depending upon where you
look (one can be first in the instruction stream but last out of the write
posting buffer).

The standard is discussed in terms of an abstract machine and the machine
the code is running on may bear only as much resemblance to the abstract
machine as is needed to make strictly-compliant code work.

DS


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to