Skip to content

Commit

Permalink
asm: angrily drop clobbers of reserved registers
Browse files Browse the repository at this point in the history
  • Loading branch information
fw-immunant committed Apr 12, 2022
1 parent 5a121d8 commit 37ba466
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions c2rust-transpile/src/translator/assembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,13 @@ impl<'c> Translation<'c> {
continue;
};

// We must drop clobbers of reserved registers, even though this
// really means we're not
if reg_is_reserved(clobber).is_some() {
warn!("Attempting to clobber reserved register ({}), dropping clobber!", clobber);
continue;
}

tokens.push(TokenTree::Punct(Punct::new(',', Alone)));
let result = mk().call_expr(mk().ident_expr("out"), vec![mk().lit_expr(clobber)]);
push_expr(&mut tokens, result);
Expand Down

0 comments on commit 37ba466

Please sign in to comment.