Skip to content

ICE const value has different size than its type #6352

@ILyoan

Description

@ILyoan
Contributor

The following test yields an ICE in trans

enum Foo {
    IntVal(i32),
    Int64Val(i64)
}

struct Bar {
    i: i32,
    v: Foo
}

static bar: Bar = Bar { i: 0, v: IntVal(0) };

fn main() {}

{ i32, { i32, i32, [8 x i8] } } { i32 0, { i32, i32, [8 x i8] } { i32 0, i32 0, [8 x i8] undef } }
{ i32, { i32, i64, [0 x i8] } } undef
error: internal compiler error: const expr(29: Bar{i: 0, v: IntVal(0),}) of type Bar has size 20 instead of 24

This error appears on arm target. and probably can appear on x86-32bit machine.

Activity

yichoi

yichoi commented on May 9, 2013

@yichoi
Contributor

This problem occurs while compiling servo for ARM target

{ i8*, { i32, i32, [8 x i8] } } { i8* getelementptr inbounds ([5 x i8]* @const55, i32 0, i32 0), { i32, i32, [8 x i8] } { i32 0, i32 0, [8 x i8] undef } } { i8*, { i32, double, [0 x i8] } } undef
error: internal compiler error: const expr(28945: ConstantSpec{name: &NONE_name as u8 as *libc::c_char, value: IntVal(0),}) of type dom::bindings::utils::ConstantSpec has size 20 instead of 24
rust: task failed at 'explicit failure', /home/aydin.kim/servo/webconv/arm_arranged/src/rust/src/libsyntax/diagnostic.rs:92
rust: task failed at 'explicit failure', /home/aydin.kim/servo/webconv/arm_arranged/src/rust/src/librustc/rustc.rc:349
rust: domain main @0x1d20410 root task failed
make: ** [servo] Error 101
pcwalton

pcwalton commented on May 23, 2013

@pcwalton
Contributor

cc @jld, I think this is your code?

june0cho

june0cho commented on May 23, 2013

@june0cho
Contributor

Compiles fine on x86 32bit machine.

pcwalton

pcwalton commented on May 31, 2013

@pcwalton
Contributor

Fixed.

yichoi

yichoi commented on Jun 1, 2013

@yichoi
Contributor

Thanks!

added a commit that references this issue on Feb 25, 2021
fe01ddc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-androidOperating system: Android

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @pcwalton@ILyoan@yichoi@june0cho

        Issue actions

          ICE const value has different size than its type · Issue #6352 · rust-lang/rust