Possible subtle memory model error in ClassValue
Doug Lea
dl at cs.oswego.edu
Mon Aug 10 12:17:44 UTC 2020
Catching up...
As implied in other posts, the minimal fix is to add a trailing release
fence (using Unsafe?) to the constructor. Or less delicately, to access
only using acquire/release (which will cost a bit on ARM/Power, but
probably not noticeable on x86), or most simply (but expensively) to
declare the field volatile.
Also, as Hans noted, the consensus seems to be that there not enough to
be gained by always adding a release fence to constructors. A few errors
like this might never occur, but other related anomalies with non-final
field accesses would remain.
-Doug
More information about the core-libs-dev
mailing list