Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an error for inline assembly which are non-volatile without any outputs #46026

Closed
Zoxc opened this issue Nov 16, 2017 · 2 comments
Closed
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-feature-request Category: A feature request, i.e: not implemented / a PR.

Comments

@Zoxc
Copy link
Contributor

Zoxc commented Nov 16, 2017

#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.

@parched
Copy link
Contributor

parched commented Nov 16, 2017

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

@kennytm kennytm added A-inline-assembly Area: Inline assembly (`asm!(…)`) C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Nov 16, 2017
@sunfishcode
Copy link
Member

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

kennytm added a commit to kennytm/rust that referenced this issue Feb 5, 2018
Make inline assembly volatile if it has no outputs. Fixes rust-lang#46026
@bors bors closed this as completed in a29d854 Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-feature-request Category: A feature request, i.e: not implemented / a PR.
Projects
None yet
Development

No branches or pull requests

4 participants