ICE: "Unsigned value 0x10000 does not fit in 16 bits" with #[repr(align(65536))]
on 16-bit target in release mode, different ICE in debug mode.
#131122
Labels
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Compile with
cargo +nightly build -Z build-std=core --target avr-unknown-gnu-atmega328 --release
(basically the same results with--target msp430-none-elf
, also a 16-bit tier 3 target)Meta
rustc --version --verbose
:Error output
rustc-ice-2024-10-02T01_00_03-507058.txt
Backtrace
If you remove
--release
(and do[profile.dev.packages."*"] opt-level = 3
to makecore
not run out of registers when compiling), then you get a different ICE:rustc-ice-2024-10-02T01_15_57-511791.txt
Error output
Note that if you remove
pub fn bar
or make it non-pub
it compiles.#[repr(align(1 << N))]
or higher should probably just give an unconditional error on (≤N)-bit targets (or maybe just anything that would determine its layout could error, similar to howcore::mem::size_of::<[u8; 0x1_0000_0000_0000]>()
fails to compile with "values of the type[u8; 281474976710656]
are too big for the current architecture" on x86_64-unknown-linux-gnu, buttype T = [u8; 0x1_0000_0000_0000];
alone is Fine™).The text was updated successfully, but these errors were encountered: