You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So far, we have a theory for what move could mean on function calls, but we don't have a clear idea what it could mean in assignments (#416). Turns out the two are tightly linked: this example compiles to the following MIR without optimizations:
Miri semantics says the former program has UB (though I have not managed to actually executed that MIR in Miri, passing -O is not enough somehow), while the latter is fine. The latter is fine since _3 = move _1; ignores the move, and so the argument actually moved to move_arg is _3 and that argument gets protected for the duration of the call.
I assume we want to allow the transformation that removes the extra move (though I don't know if we currently perform such an optimization); that is very tricky: _1 might be accessed in various ways after the move (even if we consider a move to de-init memory, one can still write to it); if the argument moved to move_arg becomes an alias of _1 that can easily introduce conflicts.
The text was updated successfully, but these errors were encountered:
So far, we have a theory for what
move
could mean on function calls, but we don't have a clear idea what it could mean in assignments (#416). Turns out the two are tightly linked: this example compiles to the following MIR without optimizations:And the following with optimizations:
Miri semantics says the former program has UB (though I have not managed to actually executed that MIR in Miri, passing
-O
is not enough somehow), while the latter is fine. The latter is fine since_3 = move _1;
ignores themove
, and so the argument actually moved tomove_arg
is_3
and that argument gets protected for the duration of the call.I assume we want to allow the transformation that removes the extra move (though I don't know if we currently perform such an optimization); that is very tricky:
_1
might be accessed in various ways after the move (even if we consider a move to de-init memory, one can still write to it); if the argument moved tomove_arg
becomes an alias of_1
that can easily introduce conflicts.The text was updated successfully, but these errors were encountered: