Skip to content

ICE; two sources of truth on how stuff is returned do not agree with each other #38727

Closed
@nagisa

Description

@nagisa

Consider this code:

#![feature(no_core, lang_items,start)]
#![no_std]
#![no_core]
#[lang="sized"] trait Sized {}
#[lang="copy"] trait Copy {}

#[repr(u64)]
enum A {
    A = 0u64,
    B = !0u64,
}

fn cmp() -> A {
    A::B
}

#[start]
fn main(b:isize, a: *const *const u8)->isize { 0 }

if compiled targetting i686 target, this ICEs with

error: internal compiler error: ../src/librustc_trans/mir/operand.rs:82: impossible case reached

This is because ABI code claims that this u64 enum has to be returned via value (i.e. ret i64 %smth):

FnType { args: [], ret: ArgType { kind: Direct, original_ty: i64, ty: i64, signedness: Some(false), cast: None, ... }

Whereas MIR only has OperandRef(Ref(...)) because the common::is_immediate_type returns false for this enum. Calling immediate() on this OperandRef then causes this ICE.

This is a regression from the old->MIR trans move.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions