[concurrency-interest] a volatile bug?

Aleksey Shipilev aleksey.shipilev at gmail.com
Wed May 16 15:00:24 EDT 2012


On Wed, May 16, 2012 at 10:40 PM, Boehm, Hans <hans.boehm at hp.com> wrote:
> A JDK bug AND a serious test suite omission?

Stress tests would probably JIT-compile the code in question. See below.

> But is the problem real?  Can it be reproduced on a mainstream JVM?

Same question.

> Note that the example in the original posting also read b before the loop,
> so naïve common subexpression elimination would cause the bug.  Hopefully
> nobody does CSE in cases like this.

FWIW, the test case in SO would probably not hit any compilation
threshold in HotSpot, so it could be executed in interpreter. Then,
assuming the interpreter does not reorder Java code, and assuming
original SO poster runs Windows, and hence x86, and hence has TSO,
this bug seems very unlikely. I would be surprised if it actually
*can* be reproduced. That makes the whole story rather interesting.

-Aleksey.



More information about the Concurrency-interest mailing list