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

assertion failed: abi != synabi::RustIntrinsic && abi != synabi::PlatformIntrinsic #28575

Closed
retep998 opened this issue Sep 21, 2015 · 11 comments · Fixed by #71182
Closed

assertion failed: abi != synabi::RustIntrinsic && abi != synabi::PlatformIntrinsic #28575

retep998 opened this issue Sep 21, 2015 · 11 comments · Fixed by #71182
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

@retep998
Copy link
Member

extern { pub static FOO: extern "rust-intrinsic" fn(); }
fn main() { FOO() }
> rustc a.rs
a.rs:1:26: 1:54 warning: found function pointer with Rust calling convention in foreign module; consider using an `extern` function pointer, #[warn(improper_ctypes)] on by default
a.rs:1 extern { pub static FOO: extern "rust-intrinsic" fn(); }
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: abi != synabi::RustIntrinsic && abi != synabi::PlatformIntrinsic', ../src/librustc_trans\trans\callee.rs:707
@eddyb eddyb added A-codegen Area: Code generation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Sep 21, 2015
@eddyb
Copy link
Member

eddyb commented Sep 21, 2015

We handle intrinsics in an odd way, we "inline" them in the current crate, and this might be a symptom of that twisted logic.

@Aatch
Copy link
Contributor

Aatch commented Sep 29, 2015

intrinsic-ABI functions should probably be disallowed as function pointers. That is, you should only be allowed to call them. This is the current situation, as calls to intrinsics actually just generate code at the call site.

@eddyb
Copy link
Member

eddyb commented Sep 29, 2015

@Aatch That's not the problem, really, I believe we already have code to generate the shims.
The problem is that we don't resolve intrinsics sanely and we rely on the ABI in the type, instead of always dealing with the paths to them and whatnot.

@arielb1
Copy link
Contributor

arielb1 commented Sep 29, 2015

@eddyb

I don't think we have code for creating the shims, even. It's more that the "rust-intrinsic" ABI isn't actually defined anywhere, and we use an alternate callee to avoid generating an actual call.

@Aatch
Copy link
Contributor

Aatch commented Sep 30, 2015

We haven't had code for generating shims around intrinsics for a long time. As @arielb1 alludes to, this is because in almost all cases the actual function would be one or two instructions long. This is consistent with how C/C++ compilers handle intrinsics, generating code inline. Best I can tell, whether or not a given intrinsic can be used as a function in C is dependent on the intrinsic in question.

@jfager
Copy link
Contributor

jfager commented Mar 21, 2017

No longer ICEs (playpen)

@eddyb
Copy link
Member

eddyb commented Mar 21, 2017

@jfager It requires #![feature(intrinsics)] now.

@jfager
Copy link
Contributor

jfager commented Mar 21, 2017

Ah, ok. Still no longer ICEs, but fails with a linker error (playpen), if the distinction matters.

@arielb1 arielb1 self-assigned this Apr 9, 2017
@Mark-Simulacrum
Copy link
Member

I think this has been fixed -- marking as E-needstest. @arielb1 Did you mean to self-assign this?

@Mark-Simulacrum Mark-Simulacrum added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jun 20, 2017
@Mark-Simulacrum Mark-Simulacrum added C-bug Category: This is a bug. and removed C-bug Category: This is a bug. labels Jul 22, 2017
@nox
Copy link
Contributor

nox commented Apr 2, 2018

This seems like it could be made into an easy issue for newcomers.

@euclio
Copy link
Contributor

euclio commented Oct 26, 2018

This is now caught by safe_extern_statics.

@Centril Centril added 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. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels Oct 25, 2019
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 16, 2020
…Simulacrum

Add some regression tests

Closes rust-lang#24843
Closes rust-lang#28575
Closes rust-lang#54067
Closes rust-lang#67893
Closes rust-lang#68813

I'm not sure who's the best person to ask to review since Centril is taking a break now.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 16, 2020
…Simulacrum

Add some regression tests

Closes rust-lang#24843
Closes rust-lang#28575
Closes rust-lang#54067
Closes rust-lang#67893
Closes rust-lang#68813

I'm not sure who's the best person to ask to review since Centril is taking a break now.
@bors bors closed this as completed in b347097 Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

Successfully merging a pull request may close this issue.

9 participants