diff options
| author | kennytm <kennytm@gmail.com> | 2018-02-06 02:13:44 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-06 02:13:44 +0800 |
| commit | eb5a4617a5ef4cb8840ae40a31cd56f9ed243ee5 (patch) | |
| tree | 4f5b7a52c2d54f3c65a375ab01cd0c82ce6ecece /src/libsyntax_ext | |
| parent | 6c04c41034c46730fba97bfe9cfa2dd0687c2a5f (diff) | |
| parent | a29d8545b573d008e364571a83fcd865748a8ad8 (diff) | |
| download | rust-eb5a4617a5ef4cb8840ae40a31cd56f9ed243ee5.tar.gz rust-eb5a4617a5ef4cb8840ae40a31cd56f9ed243ee5.zip | |
Rollup merge of #46030 - Zoxc:asm-volatile, r=nikomatsakis
Make inline assembly volatile if it has no outputs. Fixes #46026
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/asm.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsyntax_ext/asm.rs b/src/libsyntax_ext/asm.rs index 3742fb8c804..d1de4dccd00 100644 --- a/src/libsyntax_ext/asm.rs +++ b/src/libsyntax_ext/asm.rs @@ -239,6 +239,12 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, } } + // If there are no outputs, the inline assembly is executed just for its side effects, + // so ensure that it is volatile + if outputs.is_empty() { + volatile = true; + } + MacEager::expr(P(ast::Expr { id: ast::DUMMY_NODE_ID, node: ast::ExprKind::InlineAsm(P(ast::InlineAsm { |
