Skip to content

PartialEq impl for IpAddr causes SIGBUS on mips-unknown-linux-gnu #102722

Closed
@djkoloski

Description

@djkoloski

I tried this code on mips-unknown-linux-gnu through cargo-cross:

use std::net::{IpAddr, Ipv4Addr};

fn main() {
    let value = IpAddr::V4(Ipv4Addr::new(31, 41, 59, 26));
    assert_eq!(&value, &value);
}
cross run --target mips-unknown-linux-gnu --verbose

I expected to see this happen: the program exits successfully.

Instead, this happened: qemu: uncaught target signal 10 (Bus error) - core dumped

This is truly baffling because:

  1. This is extremely plain code, just a struct in an enum.
  2. This is crashing in the implementation of PartialEq which has been generated by a derive.
  3. Removing the outer IpAddr does not cause a crash.
  4. Far more complex code runs successfully.

If this is a problem with cargo-cross instead, I would be happy to move the bug to the corresponding repo.

Meta

rustc --version --verbose:

rustc 1.64.0 (a55dd71d5 2022-09-19)
binary: rustc
commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52
commit-date: 2022-09-19
host: x86_64-pc-windows-msvc
release: 1.64.0
LLVM version: 14.0.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-miscompileIssue: Correct Rust code lowers to incorrect machine codeO-MIPSTarget: MIPS processorsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions