Interpreter: volatile ldobj appears to have incorrect semantics? #3865
Open
Description
opened on Feb 3, 2015
Going by Ecma 335 III.4.13, it is my understanding that a sequence like
volatile.
ldobj MyType
should produce a volatile load. While one could argue that it's a store (the spec says "copy the value stored at address src
to the stack"), interpreting it as a load seems more appropriate if one considers that the spec also says "if typeTok
is not a generic parameter and either a reference type or a built-in value class, then the ldind
instruction provides a shorthand for the ldobj
instruction".
The relevant code:
- https://github.com/dotnet/coreclr/blob/cbf46fb0b6a0b209ed1caf4a680910b383e68cba/src/vm/interpreter.cpp#L5537
- https://github.com/dotnet/coreclr/blob/cbf46fb0b6a0b209ed1caf4a680910b383e68cba/src/vm/interpreter.cpp#L4292
category:correctness
theme:interpreter
skill-level:intermediate
cost:small
Activity