-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
While exploring building a cross-compiler and running the test suite on it, I found the following issue:
Using a config.toml
with:
host = ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu"]
target = ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu"]
and then doing x.py test
eventually hits this problem:
./build/i686-unknown-linux-gnu/stage1/bin/rustc --target=x86_64-unknown-linux-gnu -O /tmp/huge-enum.rs
warning: unused variable: `big`
--> /tmp/huge-enum.rs:23:9
|
23 | let big: Option<[u32; (1<<45)-1]> = None;
| ^^^ help: consider using `_big` instead
|
= note: #[warn(unused_variables)] on by default
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `4294967295`,
right: `35184372088831`', src/librustc_target/abi/mod.rs:716:17
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: internal compiler error: unexpected panic
The reason for this ICE is due to a mistake in rustc
's internal API here:
rust/src/librustc_target/abi/mod.rs
Lines 710 to 721 in 6d34ec1
impl FieldPlacement { | |
pub fn count(&self) -> usize { | |
match *self { | |
FieldPlacement::Union(count) => count, | |
FieldPlacement::Array { count, .. } => { | |
let usize_count = count as usize; | |
assert_eq!(usize_count as u64, count); | |
usize_count | |
} | |
FieldPlacement::Arbitrary { ref offsets, .. } => offsets.len() | |
} | |
} |
As @nagisa points out on Zulip, the compiler should not be using usize
except for its own indices "and other memory-ey things"
Metadata
Metadata
Assignees
Labels
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.