rust icon indicating copy to clipboard operation
rust copied to clipboard

ICE const value has different size than its type

Open ILyoan opened this issue 13 years ago • 5 comments

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.

ILyoan avatar May 09 '13 08:05 ILyoan

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

yichoi avatar May 09 '13 08:05 yichoi

cc @jld, I think this is your code?

pcwalton avatar May 23 '13 00:05 pcwalton

Compiles fine on x86 32bit machine.

june0cho avatar May 23 '13 09:05 june0cho

Fixed.

pcwalton avatar May 31 '13 15:05 pcwalton

Thanks!

yichoi avatar Jun 01 '13 08:06 yichoi