Closed
Description
Program:
extern crate test_1_lib;
static _UNUSED: &'static test_1_lib::SomeType = &test_1_lib::SOME_VALUE;
fn main() {
vec![0u8; test_1_lib::SOME_VALUE.some_member];
}
Crate test_1_lib:
pub struct SomeType {
pub some_member: usize,
}
pub static SOME_VALUE: SomeType = SomeType {
some_member: 1,
};
Notice that this is a static in one crate referencing a static in another crate.
A complete cargo-buildable test case is at https://github.com/briansmith/rust-bug-1. This bug was found by a user of ring. The coding pattern in this test case commonly occurs when using ring.
To reproduce:
git clone https://github.com/briansmith/rust-bug-1
cd bin
cargo build
rustc crashes with
Assertion failed: DestTy && "GEP indices invalid!", file C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\llvm\
Reproduced with (on x86_64-pc-windows-msvc):