Open
Description
What are the operational semantics of the following program:
fn main(){
asm!("mov [0], eax");
}
Specifically, how do we guarantee (and can we even guarantee) the following properties from the reference:
- The compiler cannot assume that the instructions in the asm are the ones that will actually end up executed.
- It is possible to correctly evaluate (including by causing some kind of error/ub/termination)
asm
in a "pure AM" implementation, such as miri. - The assembler (which IMO, should be regarded as a part of the compiler) is permitted to make decisions about syntax beyond the guaranteed common subset, semantics of non-guaranteed directives, and the bytes to generate from a particular assembly statement
- Machine differences are permitted to change the behaviour of assembly (either from a trap to non-trap behaviour, or betwen different non-trapping behaviour)
- General optimizations of the assembly expressions (via it's interface) and surrounding unrelated rust code, remain possible.
@rustbot label +S-pending-design
Note: This should get an A-label, but no label suitable for inline-assembly curently exists. Could someone with maintain access add such a label and then apply it to this issue?