Skip to content

How to pass target-feature in cargo-kani? #3059

@zpzigi754

Description

@zpzigi754

This symptom would only occur in aarch64 target.

I tried this code:

// src/main.rs

#[cfg(kani)]
mod verification {
    #[kani::proof]
    fn success_example() {
        assert!(true);
    }
}

fn main() {
}

with the below dependency

# Cargo.toml

[package]
name = "hello-half"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
half = { version = "2.4.0", default-features = false}

using the following command line invocation:

cargo kani

with Kani version: the latest one (12768f2)

I expected to see this happen

VERIFICATION:- SUCCESSFUL

Instead, this happened.

...
error: register class `vreg` requires the `neon` target feature
   --> /home/changho/.cargo/registry/src/index.crates.io-6f17d22bba15001f/half-2.4.0/src/binary16/arch/aarch64.rs:171:9
    |
171 |         in(vreg) a,
    |         ^^^^^^^^^^

error: register class `vreg` requires the `neon` target feature
   --> /home/changho/.cargo/registry/src/index.crates.io-6f17d22bba15001f/half-2.4.0/src/binary16/arch/aarch64.rs:172:9
    |
172 |         in(vreg) b,
    |         ^^^^^^^^^^

error: aborting due to 32 previous errors

error: could not compile `half` (lib) due to 33 previous errors
error: Failed to execute cargo (exit status: 101). Found 33 compilation errors.

The above error was caused by not adding neon target feature in the half crate. However, passing target-feature to cargo-kani (e.g., -C target-feature=+neon) doesn't seem to work.

Note that I've added a patch commit in the half crate, but being able to control target-feature would be still useful even after that patch being merged.

Metadata

Metadata

Assignees

Labels

[C] BugThis is a bug. Something isn't working.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions