Skip to content

std::arch::x86::has_cpuid() alternates between true and false when CPUID is supported #51691

Closed
@stevecheckoway

Description

@stevecheckoway

The code in question is here. The bug is on line 99 where the OR should be XOR.

This code demonstrates the bug.

#![feature(stdsimd)]
use std::arch::x86;

fn main() {
    assert_eq!(x86::has_cpuid(), x86::has_cpuid());
}

I expected to see this happen: x86::has_cpuid() should be idempotent and thus the assertion should be satisfied.

Instead, this happened:

$ rustc --target i686-apple-darwin bug.rs
$ ./bug
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `true`,
 right: `false`', bug.rs:5:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Meta

rustc 1.28.0-nightly (f28c7aef7 2018-06-19)
binary: rustc
commit-hash: f28c7aef7fbff1909c2d0257186cd7a5f0c6aa4b
commit-date: 2018-06-19
host: x86_64-apple-darwin
release: 1.28.0-nightly
LLVM version: 6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions