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

llvm: Assertion `Ty && "Invalid GetElementPtrInst indices for type!"' failed. #23649

Closed
cuviper opened this issue Mar 23, 2015 · 5 comments
Closed
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@cuviper
Copy link
Member

cuviper commented Mar 23, 2015

Fedora 21 x86_64, rustc 1.0.0-nightly (b0aad7d 2015-03-22) (built 2015-03-23).

I hit an assertion when compiling cuviper/rust-git-fs@db151bc. I haven't tried to reduce it yet.

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/include/llvm/IR/Instructions.h:782: llvm::Type* llvm::checkGEPType(llvm::Type*): Assertion `Ty && "Invalid GetElementPtrInst indices for type!"' failed.

Stack trace from coredumpctl:

Stack trace of thread 25718:
#0  0x00007f504e03f8d7 __GI_raise (libc.so.6)
#1  0x00007f504e04153a __GI_abort (libc.so.6)
#2  0x00007f504e03847d __assert_fail_base (libc.so.6)
#3  0x00007f504e038532 __GI___assert_fail (libc.so.6)
#4  0x00007f504911dd68 _ZN4llvm12checkGEPTypeEPNS_4TypeE.part.95 (librustc_llvm-4e7c5e5c.so)
#5  0x00007f504911fa73 _ZN4llvm17GetElementPtrInst16getGEPReturnTypeEPNS_5ValueENS_8ArrayRefIS2_EE (librustc_llvm-4e7c5e5c.so)
#6  0x00007f504911fade _ZN4llvm17GetElementPtrInstC2EPNS_5ValueENS_8ArrayRefIS2_EEjRKNS_5TwineEPNS_11InstructionE (librustc_llvm-4e7c5e5c.so)
#7  0x00007f5049121c8f _ZN4llvm9IRBuilderILb1ENS_14ConstantFolderENS_24IRBuilderDefaultInserterILb1EEEE17CreateInBoundsGEPEPNS_5ValueENS_8ArrayRefIS6_EERKNS_5TwineE (librustc_llvm-4e7c5e5c.so)
#8  0x00007f504a1a42ec LLVMBuildInBoundsGEP (librustc_llvm-4e7c5e5c.so)
#9  0x00007f504dbae926 _ZN5trans5build4GEPi20hc71b126e77a04cc55jpE (librustc_trans-4e7c5e5c.so)
#10 0x00007f504dc79632 _ZN5trans6_match16compile_submatch20h6e016bcd208285adjVvE (librustc_trans-4e7c5e5c.so)
#11 0x00007f504dc809d9 _ZN5trans6_match25compile_submatch_continue20h731efec36c660dc3e1vE (librustc_trans-4e7c5e5c.so)
#12 0x00007f504dc79a59 _ZN5trans6_match16compile_submatch20h6e016bcd208285adjVvE (librustc_trans-4e7c5e5c.so)
#13 0x00007f504dc7d385 _ZN5trans6_match25compile_submatch_continue20h731efec36c660dc3e1vE (librustc_trans-4e7c5e5c.so)
#14 0x00007f504dc79a59 _ZN5trans6_match16compile_submatch20h6e016bcd208285adjVvE (librustc_trans-4e7c5e5c.so)
#15 0x00007f504dc82a4e _ZN5trans6_match17trans_match_inner20h331c89f2cce6152f3swE (librustc_trans-4e7c5e5c.so)
#16 0x00007f504dbe1d2d _ZN5trans4expr27trans_rvalue_dps_unadjusted20hab2f29f73a88d75b1miE (librustc_trans-4e7c5e5c.so)
#17 0x00007f504db9d14a _ZN5trans4expr10trans_into20hd7c15316e0f4e95818gE (librustc_trans-4e7c5e5c.so)
#18 0x00007f504db9e163 _ZN5trans11controlflow11trans_block20h5e8ab5bfa7f25c74R5dE (librustc_trans-4e7c5e5c.so)
#19 0x00007f504dc636a9 _ZN5trans4base13trans_closure20heebe9acc13fc14ffh4sE (librustc_trans-4e7c5e5c.so)
#20 0x00007f504db87cb9 _ZN5trans4base8trans_fn20h62bbdc2e4afebf2baftE (librustc_trans-4e7c5e5c.so)
#21 0x00007f504db893a1 _ZN5trans12monomorphize14monomorphic_fn20h1eb68cf48c5b441bqtdE (librustc_trans-4e7c5e5c.so)
#22 0x00007f504dbc77b0 _ZN5trans6callee24trans_fn_ref_with_substs20ha0b048ac20220cf3v6fE (librustc_trans-4e7c5e5c.so)
#23 0x00007f504dbdb9ae _ZN5trans4meth19trans_method_callee20hb455f746b59e4bdbvNxE (librustc_trans-4e7c5e5c.so)
#24 0x00007f504dbd7daa _ZN5trans6callee16trans_call_inner21h15762136108892919716E (librustc_trans-4e7c5e5c.so)
#25 0x00007f504dbe15a8 _ZN5trans4expr27trans_rvalue_dps_unadjusted20hab2f29f73a88d75b1miE (librustc_trans-4e7c5e5c.so)
#26 0x00007f504db9d14a _ZN5trans4expr10trans_into20hd7c15316e0f4e95818gE (librustc_trans-4e7c5e5c.so)
#27 0x00007f504db9c325 _ZN5trans11controlflow15trans_stmt_semi20h106b31175f759eb944dE (librustc_trans-4e7c5e5c.so)
#28 0x00007f504db9ddc1 _ZN5trans11controlflow11trans_block20h5e8ab5bfa7f25c74R5dE (librustc_trans-4e7c5e5c.so)
#29 0x00007f504dc636a9 _ZN5trans4base13trans_closure20heebe9acc13fc14ffh4sE (librustc_trans-4e7c5e5c.so)
#30 0x00007f504db87cb9 _ZN5trans4base8trans_fn20h62bbdc2e4afebf2baftE (librustc_trans-4e7c5e5c.so)
#31 0x00007f504db892fc _ZN5trans12monomorphize14monomorphic_fn20h1eb68cf48c5b441bqtdE (librustc_trans-4e7c5e5c.so)
#32 0x00007f504dbc77b0 _ZN5trans6callee24trans_fn_ref_with_substs20ha0b048ac20220cf3v6fE (librustc_trans-4e7c5e5c.so)
#33 0x00007f504dbc5d8f _ZN5trans6callee12trans_fn_ref20h307ba6fabe2bf10f5UfE (librustc_trans-4e7c5e5c.so)
#34 0x00007f504dbc39ae _ZN5trans6callee5trans20h377cc02a72432fc1mKfE (librustc_trans-4e7c5e5c.so)
#35 0x00007f504dbd652c _ZN5trans6callee16trans_call_inner21h12051749445897582865E (librustc_trans-4e7c5e5c.so)
#36 0x00007f504dbe27d5 _ZN5trans4expr27trans_rvalue_dps_unadjusted20hab2f29f73a88d75b1miE (librustc_trans-4e7c5e5c.so)
#37 0x00007f504db9d14a _ZN5trans4expr10trans_into20hd7c15316e0f4e95818gE (librustc_trans-4e7c5e5c.so)
#38 0x00007f504db9e163 _ZN5trans11controlflow11trans_block20h5e8ab5bfa7f25c74R5dE (librustc_trans-4e7c5e5c.so)
#39 0x00007f504dc636a9 _ZN5trans4base13trans_closure20heebe9acc13fc14ffh4sE (librustc_trans-4e7c5e5c.so)
#40 0x00007f504db87cb9 _ZN5trans4base8trans_fn20h62bbdc2e4afebf2baftE (librustc_trans-4e7c5e5c.so)
#41 0x00007f504db893a1 _ZN5trans12monomorphize14monomorphic_fn20h1eb68cf48c5b441bqtdE (librustc_trans-4e7c5e5c.so)
#42 0x00007f504dbc77b0 _ZN5trans6callee24trans_fn_ref_with_substs20ha0b048ac20220cf3v6fE (librustc_trans-4e7c5e5c.so)
#43 0x00007f504dbc5d8f _ZN5trans6callee12trans_fn_ref20h307ba6fabe2bf10f5UfE (librustc_trans-4e7c5e5c.so)
#44 0x00007f504dbd9656 _ZN5trans4meth19trans_method_callee20hb455f746b59e4bdbvNxE (librustc_trans-4e7c5e5c.so)
#45 0x00007f504dbd7daa _ZN5trans6callee16trans_call_inner21h15762136108892919716E (librustc_trans-4e7c5e5c.so)
#46 0x00007f504dbe15a8 _ZN5trans4expr27trans_rvalue_dps_unadjusted20hab2f29f73a88d75b1miE (librustc_trans-4e7c5e5c.so)
#47 0x00007f504db9d14a _ZN5trans4expr10trans_into20hd7c15316e0f4e95818gE (librustc_trans-4e7c5e5c.so)
#48 0x00007f504dc9a9b8 _ZN5trans6_match17mk_binding_alloca20h2797419740632493683E (librustc_trans-4e7c5e5c.so)
#49 0x00007f504db9c58e _ZN5trans4base10init_local20h96ebc929e2d1c887ljsE (librustc_trans-4e7c5e5c.so)
#50 0x00007f504db9ddf3 _ZN5trans11controlflow11trans_block20h5e8ab5bfa7f25c74R5dE (librustc_trans-4e7c5e5c.so)
#51 0x00007f504dc636a9 _ZN5trans4base13trans_closure20heebe9acc13fc14ffh4sE (librustc_trans-4e7c5e5c.so)
#52 0x00007f504db87cb9 _ZN5trans4base8trans_fn20h62bbdc2e4afebf2baftE (librustc_trans-4e7c5e5c.so)
#53 0x00007f504db893a1 _ZN5trans12monomorphize14monomorphic_fn20h1eb68cf48c5b441bqtdE (librustc_trans-4e7c5e5c.so)
#54 0x00007f504dbc77b0 _ZN5trans6callee24trans_fn_ref_with_substs20ha0b048ac20220cf3v6fE (librustc_trans-4e7c5e5c.so)
#55 0x00007f504dbc5d8f _ZN5trans6callee12trans_fn_ref20h307ba6fabe2bf10f5UfE (librustc_trans-4e7c5e5c.so)
#56 0x00007f504dbd9656 _ZN5trans4meth19trans_method_callee20hb455f746b59e4bdbvNxE (librustc_trans-4e7c5e5c.so)
#57 0x00007f504dbd7daa _ZN5trans6callee16trans_call_inner21h15762136108892919716E (librustc_trans-4e7c5e5c.so)
#58 0x00007f504dbe15a8 _ZN5trans4expr27trans_rvalue_dps_unadjusted20hab2f29f73a88d75b1miE (librustc_trans-4e7c5e5c.so)
#59 0x00007f504dbe0509 _ZN5trans4expr16trans_unadjusted20he43ea67f07250abdyRhE (librustc_trans-4e7c5e5c.so)
#60 0x00007f504db9eac1 _ZN5trans4expr5trans20h65042838189368a2jfhE (librustc_trans-4e7c5e5c.so)
#61 0x00007f504dbd2244 _ZN5trans6callee10trans_args20h1b74c36c536d5b2bNMgE (librustc_trans-4e7c5e5c.so)
#62 0x00007f504dbd8c18 _ZN5trans6callee16trans_call_inner21h15762136108892919716E (librustc_trans-4e7c5e5c.so)
#63 0x00007f504dbe15a8 _ZN5trans4expr27trans_rvalue_dps_unadjusted20hab2f29f73a88d75b1miE (librustc_trans-4e7c5e5c.so)

Stack trace of thread 25717:
#0  0x00007f50484275e5 pthread_join (libpthread.so.0)
#1  0x00007f504e52aef3 _ZN6thread10JoinHandle4join20h8b3b5dfc3089534c7mwE (libstd-4e7c5e5c.so)
#2  0x00007f504ec217ad _ZN3run20h063ba822e25c126bb2bE (librustc_driver-4e7c5e5c.so)
#3  0x00007f504ec35c6c _ZN4main20h01390c9895ee9e70k9cE (librustc_driver-4e7c5e5c.so)
#4  0x00007f504e5d8359 rust_try_inner (libstd-4e7c5e5c.so)
#5  0x00007f504e5d8346 rust_try (libstd-4e7c5e5c.so)
#6  0x00007f504e5642ac _ZN2rt10lang_start20h9704c9322344f817UdJE (libstd-4e7c5e5c.so)
#7  0x00007f504e02afe0 __libc_start_main (libc.so.6)
#8  0x00007f504f093749 _start (rustc)
@jdm jdm added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 23, 2015
@mahkoh
Copy link
Contributor

mahkoh commented Mar 25, 2015

pub struct X([u8]);

fn _f(x: &X) { match *x { X(ref x) =>  { } } }

fn main() { }
Assertion `Ty && "Invalid GetElementPtrInst indices for type!"' failed.

cuviper added a commit to cuviper/rust-git-fs that referenced this issue Mar 30, 2015
- cargo update
- feature updates
- Change AsPath to AsRef<Path>

Still aborts on src/lib.rs, rust-lang/rust#23649
@cuviper
Copy link
Member Author

cuviper commented Mar 30, 2015

I narrowed this down to my RefDir::lookup(), where a HashMap<PathBuf,_> is indexed by a &Path. I can reproduce the crash with this smaller example:

use std::collections::HashMap;
use std::path::{Path, PathBuf};

fn main() {
    let m: HashMap<PathBuf, ()> = HashMap::new();
    let k = Path::new("foo");
    println!("{:?}", m.get(k));
}

If I convert k to a PathBuf first, then all is fine.

@tomprogrammer
Copy link
Contributor

Another example is:

#[derive(PartialEq)]
struct Slice { slice: [u8] }

@arielb1
Copy link
Contributor

arielb1 commented Jun 14, 2015

Does not seem to affect beta or nightly. Marking as E-needstest

@arielb1 arielb1 added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jun 14, 2015
@frewsxcv
Copy link
Member

I'll add regression tests for these examples right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants