Boszormenyi Zoltan <zb@cybertec.at> writes:
> How about the attached patch over current GIT? In other words,
> why I am wrong with this idea?
Because it's wrong. Removing "volatile" means that the compiler is
permitted to optimize away stores (and fetches!) on the basis of their
being unnecessary according to straight-line analysis of the code.
Write barriers don't fix that, they only say that stores that the
compiler chooses to issue at all have to be ordered a certain way.
(There are also pretty serious questions as to whether pg_write_barrier
can be trusted yet, but it doesn't really matter here. Removing
volatile would break the code.)
regards, tom lane