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

asm! with u128 fails to compile - invalid memory reference #51018

Closed
Ragnaroek opened this issue May 24, 2018 · 5 comments
Closed

asm! with u128 fails to compile - invalid memory reference #51018

Ragnaroek opened this issue May 24, 2018 · 5 comments
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Ragnaroek
Copy link

Ragnaroek commented May 24, 2018

Using the now stable u128 in an asm! macro crashes the compiler.

Code to reproduce:
https://gist.github.com/rust-play/954f1ccc1cd8004df576a43b6514b401

Reproducable on the playground and macOS. On macOS the error message is:

error: Could not compile mithril.

Caused by:
process didn't exit successfully: rustc --crate-name mithril src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=e7b8648dc96b2094 -C extra-filename=-e7b8648dc96b2094 --out-dir /Users/mb/pprojects/mithril/target/debug/deps -C incremental=/Users/mb/pprojects/mithril/target/debug/incremental -L dependency=/Users/mb/pprojects/mithril/target/debug/deps --extern env_logger=/Users/mb/pprojects/mithril/target/debug/deps/libenv_logger-f4f513ab1223272f.rlib --extern bandit=/Users/mb/pprojects/mithril/target/debug/deps/libbandit-4c1e67613f3f77ac.rlib --extern serde_derive=/Users/mb/pprojects/mithril/target/debug/deps/libserde_derive-be3fca48459907f5.dylib --extern serde_json=/Users/mb/pprojects/mithril/target/debug/deps/libserde_json-711c5ee6a421b953.rlib --extern jhffi=/Users/mb/pprojects/mithril/target/debug/deps/libjhffi-9ed97b90d2952145.rlib --extern config=/Users/mb/pprojects/mithril/target/debug/deps/libconfig-e2e5d7589e9b7f20.rlib --extern blake=/Users/mb/pprojects/mithril/target/debug/deps/libblake-72647039190c341c.rlib --extern skeinffi=/Users/mb/pprojects/mithril/target/debug/deps/libskeinffi-376e1906e19563be.rlib --extern byteorder=/Users/mb/pprojects/mithril/target/debug/deps/libbyteorder-49761a93f2c8b743.rlib --extern tiny_keccak=/Users/mb/pprojects/mithril/target/debug/deps/libtiny_keccak-e51e268bdb8727cc.rlib --extern groestl=/Users/mb/pprojects/mithril/target/debug/deps/libgroestl-6dfc9492e11b0fc4.rlib --extern serde=/Users/mb/pprojects/mithril/target/debug/deps/libserde-4c061d99045b66f7.rlib --extern num_cpus=/Users/mb/pprojects/mithril/target/debug/deps/libnum_cpus-a0f20e1acd1dc757.rlib --extern log=/Users/mb/pprojects/mithril/target/debug/deps/liblog-b7873a215694991b.rlib -L native=/Users/mb/pprojects/mithril/target/debug/build/blake-0629bde5aab754f8/out -L native=/Users/mb/pprojects/mithril/target/debug/build/jh-ffi-a8d639c8dd0be45a/out -L native=/Users/mb/pprojects/mithril/target/debug/build/skein-ffi-c29e2293896d09bc/out (signal: 11, SIGSEGV: invalid memory reference)

rustc --version
rustc 1.27.0-nightly (2f2a11d 2018-05-16)

@Ragnaroek
Copy link
Author

anything new on this one?

@Amanieu
Copy link
Member

Amanieu commented Jun 17, 2018

Try transmuting to __m128 first.

Generally the problem here is that we don't do any type checking for inline asm, but this is a known problem.

@kennytm kennytm added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. A-inline-assembly Area: Inline assembly (`asm!(…)`) C-bug Category: This is a bug. labels Jun 17, 2018
@levex
Copy link
Contributor

levex commented Sep 26, 2018

I am unable to reproduce this on a Linux box: https://gist.github.com/levex/c9f77d7721463ddb26e229ef512037a2

Does this still reproduce on macOS?

@Centril Centril added the requires-nightly This issue requires a nightly compiler in some way. label Oct 25, 2019
@jonas-schievink jonas-schievink added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 22, 2019
@rossmacarthur
Copy link
Contributor

I am unable to reproduce on macOS, and get the same error @levex does.

@Amanieu
Copy link
Member

Amanieu commented May 22, 2020

This issue does not apply to the new asm! (RFC 2850) which has stricter checks on the types that can be used as asm operands.

The legacy llvm_asm! is deprecated and is no longer maintained.

@Amanieu Amanieu closed this as completed May 22, 2020
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-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants