Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE const value has different size than its type #6352

Closed
ILyoan opened this issue May 9, 2013 · 5 comments
Closed

ICE const value has different size than its type #6352

ILyoan opened this issue May 9, 2013 · 5 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-android Operating system: Android

Comments

@ILyoan
Copy link
Contributor

ILyoan commented May 9, 2013

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.

@yichoi
Copy link
Contributor

yichoi commented May 9, 2013

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
Copy link
Contributor

cc @jld, I think this is your code?

@june0cho
Copy link
Contributor

Compiles fine on x86 32bit machine.

@pcwalton
Copy link
Contributor

Fixed.

@yichoi
Copy link
Contributor

yichoi commented Jun 1, 2013

Thanks!

flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 25, 2021
… r=matthiaskrgr

Inconsistent struct constructor

fixes: rust-lang#6352
r? `@matthiaskrgr`

I added the lint that checks for the struct constructors where the order of the field init shorthands is inconsistent with that in the struct definition.

changelog: Add style lint: `inconsistent_struct_constructor`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-android Operating system: Android
Projects
None yet
Development

No branches or pull requests

4 participants