rust-lang / rust-lang/rust

Scalable vector ABI check seems incomplete

Open
#161,753 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

F-scalable-vectors needs-triage
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

https://github.com/rust-lang/rust/pull/143924 extended the ABI checks that we run during monomorphization to also cover scalable vectors. However, those ABI checks were only meant to catch "C" ABI problems, and they are therefore partially disabled for "Rust" ABI calls. Specifically, while we are checking "Rust" ABI definitions, we are not checking "Rust" ABI calls:

https://github.com/rust-lang/rust/blob/973c3f61d443e2ae157cd6a9275fe7635cbe0e70/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs#L199-L205

One can therefore compile this code without having the scalable vector target feature enabled:

fn foo(f: fn() -> svint32_t) {
  let _x = f();
}

At least, that's what I would expect; I don't have the setup to test this.

Cc @davidtwco @workingjubilee
Tracking issue: https://github.com/rust-lang/rust/issues/145052

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in compiler/rustc_monomorphize/src/mono_checks/abi_check.rs around lines 199-205 and compare the existing Rust ABI definition handling with Rust ABI calls. Use the scalable-vector function-pointer example in the issue as the reproduction case. Done means the call is checked consistently and the example cannot compile without the scalable vector target feature.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.