Description
Good day, it appears that something is wrong with constants on the 32-bit powerpc linux flavor of nightly rustc, here's a simple example program:
const TEST_NUM_CONST: u32 = 512;
#[derive(Debug)]
struct Point {
x: u32,
y: u32,
}
const TEST_STRUCT_CONST: Point = Point { x: 428, y: 314 };
fn main() {
println!("The numeric constant is: {}", TEST_NUM_CONST);
println!("The struct constant is: {:?}", TEST_STRUCT_CONST);
}
What I expect it to output, and what it does indeed output on x86_64, is:
The numeric constant is: 512
The struct constant is: Point { x: 428, y: 314 }
However, on PowerPC, rustc fails with:
error: int literal is too large
--> main.rs:1:29
|
1 | const TEST_NUM_CONST: u32 = 512;
| ^^^
error: aborting due to previous error
If I comment out the numeric constant and its use, leaving the structure constant in, rustc reliably crashes due to memory corruption:
*** Error in `/home/dusan/.rustup/toolchains/nightly-powerpc-unknown-linux-gnu/bin/rustc': double free or corruption (out): 0xb7cc57d8 ***
======= Backtrace: =========
(link to full output: https://gist.github.com/dusxmt/1601ecd375e3092955ff8ec9c8a69456 )
$ rustc --version --verbose
rustc 1.16.0-nightly (1a2ed98 2017-01-13)
binary: rustc
commit-hash: 1a2ed98
commit-date: 2017-01-13
host: powerpc-unknown-linux-gnu
release: 1.16.0-nightly
LLVM version: 3.9
$ uname -a
Linux power-dooshki 4.4.39-gentoo #1 Fri Jan 6 23:47:44 CET 2017 ppc 7450, altivec supported PowerBook3,3 GNU/Linux