Different error outputs for rustup and source built rustc

This problem arose when I was trying to fix the issue presented on this rust issue page. Here is the source code:

fn main() {
    let (a, b) = get_pair();
}

fn get_pair() -> (f64, f64) {
    (0.0, 0.0)
}

When I try to compile the above code with SSE2 register disabled, the compilers built from source and rustup behave differently even when they are the same version.

d50032309@ptlaby31:~$ rust_install_temp/bin/rustc -C target-feature=-sse2 --allow warnings issue65844.rs # this is the rustc built from source
rustc: /home/d50032309/rust/src/llvm-project/llvm/lib/Target/X86/X86FloatingPoint.cpp:318: unsigned int getFPReg(const llvm::MachineOperand&): Assertion `Reg >= X86::FP0 && Reg <= X86::FP6 && "Expected FP register!"' failed.
Aborted (core dumped)
d50032309@ptlaby31:~$ .cargo/bin/rustc -C target-feature=-sse2 --allow warnings issue65844.rs # This is the same version of rustc, built from rustup
error: <unknown>:0:0: in function _ZN10issue658448get_pair17h1ac16997cb4aec1eE { double, double } (): SSE2 register return with SSE2 disabled

error: aborting due to previous error

In config.toml, I have set optimize=false and assertions=false, but the compiler still throws an assertion failure. What would be the problem here?

The error is coming from LLVM, so it is likely due to LLVM version difference.

llvm versions are actually the same on my end. In fact, any version of llvm&rustc built from source (after 05-2023) gives

rustc: /home/d50032309/rust/src/llvm-project/llvm/lib/Target/X86/X86FloatingPoint.cpp:318: unsigned int getFPReg(const llvm::MachineOperand&): Assertion `Reg >= X86::FP0 && Reg <= X86::FP6 && "Expected FP register!"' failed.
Aborted (core dumped)

And that built from rustup gives

error: <unknown>:0:0: in function _ZN10issue658448get_pair17h1ac16997cb4aec1eE { double, double } (): SSE2 register return with SSE2 disabled

error: aborting due to previous error

Is anyone experiencing this issue as well? I am wondering whether this is an issue that might need fixing, therefore it would be great if someone can try and reproduce it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.