Rust: Add an error for inline assembly which are non-volatile without any outputs

Created on 16 Nov 2017  路  2Comments  路  Source: rust-lang/rust

https://github.com/rust-lang/rust/pull/45920 turned up some usages of inline assembly which have no outputs. LLVM will just remove such inline assembly as they can never be used. We should make this an error.

A-inline-assembly C-feature-request

Most helpful comment

It's worth considering an error though; inline asm is uncommon and extraordinarily unsafe, conditions which generally favor explicitness over implicitness.

All 2 comments

Alternatively, do what GCC does and add volatile automatically if there are no outputs.

It's worth considering an error though; inline asm is uncommon and extraordinarily unsafe, conditions which generally favor explicitness over implicitness.

Was this page helpful?
0 / 5 - 0 ratings