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

ICE while checking match with struct-like patterns #8351

Closed
dim-an opened this issue Aug 6, 2013 · 2 comments
Closed

ICE while checking match with struct-like patterns #8351

dim-an opened this issue Aug 6, 2013 · 2 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@dim-an
Copy link
Contributor

dim-an commented Aug 6, 2013

ICE while compiling following code:

enum E {
    Foo{f: int},
    Bar
}

pub fn main() {
    let e = Foo{f: 1};
    match e {
        Foo{f: 0} => fail!(),
        Foo{_} => (),
        _ => fail!(),
    }
}
~ » RUST_LOG=rustc=1,::rt::backtrace rustc test.rs
rust: task failed at 'index out of bounds: the len is 0 but the index is 0', /home/ermolovd/workspace/rust/src/librustc/middle/check_match.rs:231
/home/ermolovd/.local/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7f142848673b]
/home/ermolovd/.local/bin/../lib/librustrt.so(+0x2ad59)[0x7f1428497d59]
/home/ermolovd/.local/bin/../lib/librustrt.so(upcall_fail+0x1a8)[0x7f14284887b8]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(_ZN3sys6rustrt16rust_upcall_fail17_f25e955198ccc5c014_0$x2e8$x2dpreE+0x37)[0x7f142abcf8d7]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(_ZN3sys13begin_unwind_16_89e154cd091567114_0$x2e8$x2dpreE+0x71)[0x7f142abcfe61]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x91a0e)[0x7f142aaa9a0e]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x1cc66a)[0x7f142abe466a]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x17ee09)[0x7f142ab96e09]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0xe350a)[0x7f142aafb50a]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x11174d)[0x7f142ab2974d]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x17ebc0)[0x7f142ab96bc0]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(_ZN8unstable4lang17fail_bounds_check17_7112ff25e39642a214_0$x2e8$x2dpreE+0x211)[0x7f142aab64e1]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(_ZN6middle11check_match9is_useful16_1efec9c180b8af314_0$x2e8$x2dpreE+0x4b7)[0x7f142909b467]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(_ZN6middle11check_match21is_useful_specialized17_a8ff93c88f76c27914_0$x2e8$x2dpreE+0x430)[0x7f14290a3580]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(_ZN6middle11check_match9is_useful16_1efec9c180b8af314_0$x2e8$x2dpreE+0x240f)[0x7f142909d3bf]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(_ZN6middle11check_match10check_arms17_1c832619b9e2589c14_0$x2e8$x2dpreE+0x64b)[0x7f142909539b]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(_ZN6middle11check_match10check_expr17_7a4496e893c2d5d114_0$x2e8$x2dpreE+0x3bb)[0x7f142909275b]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0x9d4feb)[0x7f1429091feb]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0x67f939)[0x7f1428d3c939]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0x67f5a1)[0x7f1428d3c5a1]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0x67f23f)[0x7f1428d3c23f]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0x68adb7)[0x7f1428d47db7]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(_ZN6middle11check_match8check_fn17_85bb11c86427ffcc14_0$x2e8$x2dpreE+0x151)[0x7f14290944c1]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0x9d728e)[0x7f142909428e]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0x67c694)[0x7f1428d39694]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0x67ba23)[0x7f1428d38a23]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0x67acf7)[0x7f1428d37cf7]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0x67a884)[0x7f1428d37884]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0x4222be)[0x7f1428adf2be]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(_ZN6middle11check_match11check_crate17_3edff8522e9cc9ee14_0$x2e8$x2dpreE+0xbca)[0x7f142909181a]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0xf57836)[0x7f1429614836]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0x9b95d9)[0x7f14290765d9]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(_ZN6driver6driver27phase_3_run_analysis_passes17_1b99c65643aa108b14_0$x2e8$x2dpreE+0x139b)[0x7f1429611c5b]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(_ZN6driver6driver13compile_input15_4c53e9c6f69a0114_0$x2e8$x2dpreE+0x7e4)[0x7f1429617904]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(_ZN12run_compiler16_0184613adfc5db914_0$x2e8$x2dpreE+0x27c7)[0x7f1429653637]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0xfd24ea)[0x7f142968f4ea]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0xfcc48c)[0x7f142968948c]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(+0xfb9e06)[0x7f1429676e06]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x16aaf7)[0x7f142ab82af7]
/home/ermolovd/.local/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x2b)[0x7f14284870fb]
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /home/ermolovd/workspace/rust/src/librustc/rustc.rs:358
/home/ermolovd/.local/bin/../lib/librustrt.so(_ZN9rust_task13begin_failureEPKcS1_m+0x4b)[0x7f142848673b]
/home/ermolovd/.local/bin/../lib/librustrt.so(+0x2ad59)[0x7f1428497d59]
/home/ermolovd/.local/bin/../lib/librustrt.so(upcall_fail+0x1a8)[0x7f14284887b8]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(_ZN3sys6rustrt16rust_upcall_fail17_f25e955198ccc5c014_0$x2e8$x2dpreE+0x37)[0x7f142abcf8d7]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(_ZN3sys13begin_unwind_16_89e154cd091567114_0$x2e8$x2dpreE+0x71)[0x7f142abcfe61]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x1b853f)[0x7f142abd053f]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x1b7ccb)[0x7f142abcfccb]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x1b7a90)[0x7f142abcfa90]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x1b79e9)[0x7f142abcf9e9]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x1b7944)[0x7f142abcf944]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x1b84e8)[0x7f142abd04e8]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x1b7ccb)[0x7f142abcfccb]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x1b7a90)[0x7f142abcfa90]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x1b79e9)[0x7f142abcf9e9]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0x1b7944)[0x7f142abcf944]
/home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so(+0xb24d3)[0x7f142aaca4d3]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(_ZN7monitor17_b5614286b08b504b14_0$x2e8$x2dpreE+0xa22)[0x7f1429655fa2]
/home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so(_ZN4main15_f3d16eaf7d573814_0$x2e8$x2dpreE+0x88)[0x7f142968f328]
rustc[0x400c0e]
rustc(_rust_main+0x2e)[0x400c3e]
/home/ermolovd/.local/bin/../lib/librustrt.so(_Z18task_start_wrapperP10spawn_args+0x2b)[0x7f14284870fb]
rust: domain main @0x16a6db0 root task failed
@jdm
Copy link
Contributor

jdm commented Aug 6, 2013

A gdb backtrace from rust_task_fail would be informative.

@dim-an
Copy link
Contributor Author

dim-an commented Aug 7, 2013


#0  rust_task_fail (task=0x7fffec203c80, 
    expr=0x7fffe45cb140 "index out of bounds: the len is 0 but the index is 0", file=0x7ffff62ae1a0 <str65739> "/home/ermolovd/workspace/rust/src/librustc/middle/check_match.rs", line=231)
    at /home/ermolovd/workspace/rust/src/rt/rust_task.cpp:90
#1  0x00007ffff50a0d59 in __morestack ()
   from /home/ermolovd/.local/bin/../lib/librustrt.so
#2  0x00007ffff50917b8 in call_on_c_stack (
    fn_ptr=0x7ffff50910f0 <upcall_s_fail(s_fail_args*)>, args=0x7ffff15f1360, 
    this=0x7fffec203c80)
    at /home/ermolovd/workspace/rust/src/rt/rust_task.h:481
#3  call_upcall_on_c_stack (
    fn_ptr=0x7ffff50910f0 <upcall_s_fail(s_fail_args*)>, args=0x7ffff15f1360, 
    task=<optimized out>)
    at /home/ermolovd/workspace/rust/src/rt/rust_upcall.cpp:51
#4  upcall_fail (expr=<optimized out>, 
    file=0x7ffff62ae1a0 <str65739> "/home/ermolovd/workspace/rust/src/librustc/middle/check_match.rs", line=231)
    at /home/ermolovd/workspace/rust/src/rt/rust_upcall.cpp:134
#5  0x00007ffff77d88d7 in sys::rustrt::rust_upcall_fail::_f25e955198ccc5c0::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#6  0x00007ffff77d8e61 in sys::begin_unwind_::_89e154cd0915671::_0$x2e8$x2dpre
---Type <return> to continue, or q <return> to quit---
    () from /home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#7  0x00007ffff76b2a0e in unstable::lang::fail_::_89e154cd0915671::_0$x2e8$x2dpre () from /home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#8  0x00007ffff77ed66a in unstable::lang::fail_bounds_check::anon::expr_fn_26335 () from /home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#9  0x00007ffff779fe09 in str::__extensions__::as_c_str_23197::anon::expr_fn_23200 () from /home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#10 0x00007ffff770450a in vec::__extensions__::as_imm_buf_15036::_ad5b8a27a3c3790::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#11 0x00007ffff773274d in str::__extensions__::as_imm_buf_17989::_ad5b8a27a3c3790::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#12 0x00007ffff779fbc0 in str::__extensions__::as_c_str_23197::_d69de411ee2549::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#13 0x00007ffff76bf4e1 in unstable::lang::fail_bounds_check::_7112ff25e39642a2::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#14 0x00007ffff5ca4467 in middle::check_match::is_useful::_1efec9c180b8af3::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#15 0x00007ffff5cac580 in middle::check_match::is_useful_specialized::_a8ff93c88---Type <return> to continue, or q <return> to quit---
f76c279::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#16 0x00007ffff5ca63bf in middle::check_match::is_useful::_1efec9c180b8af3::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#17 0x00007ffff5c9e39b in middle::check_match::check_arms::_1c832619b9e2589c::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#18 0x00007ffff5c9b75b in middle::check_match::check_expr::_7a4496e893c2d5d1::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#19 0x00007ffff5c9afeb in middle::check_match::check_crate::anon::expr_fn_65576
    ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#20 0x00007ffff5945939 in oldvisit::visit_expr_opt_51892::_18f64827e554d7cd::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#21 0x00007ffff59455a1 in oldvisit::visit_block_51889::_e6e619698347db51::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#22 0x00007ffff594523f in oldvisit::default_visitor_51839::anon::expr_fn_51887
    ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
---Type <return> to continue, or q <return> to quit---
#23 0x00007ffff5950db7 in oldvisit::visit_fn_51940::_d9546aecbdd6eee::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#24 0x00007ffff5c9d4c1 in middle::check_match::check_fn::_85bb11c86427ffcc::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#25 0x00007ffff5c9d28e in middle::check_match::check_crate::anon::expr_fn_65594
    ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#26 0x00007ffff5942694 in oldvisit::visit_item_51864::_b83b1cc7f1a7ba5b::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#27 0x00007ffff5941a23 in oldvisit::default_visitor_51839::anon::expr_fn_51862
    ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#28 0x00007ffff5940cf7 in oldvisit::visit_mod_51844::_6976f7d8c85555ba::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#29 0x00007ffff5940884 in oldvisit::default_visitor_51839::anon::expr_fn_51842
    ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#30 0x00007ffff56e82be in oldvisit::visit_crate_37522::_f46a3e54d45a1f4::_0$x2e8$x2dpre ()
---Type <return> to continue, or q <return> to quit---
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#31 0x00007ffff5c9a81a in middle::check_match::check_crate::_3edff8522e9cc9ee::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#32 0x00007ffff621d836 in driver::driver::phase_3_run_analysis_passes::anon::expr_fn_95862 ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#33 0x00007ffff5c7f5d9 in util::common::time_65127::_c4d0513e54dc658e::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#34 0x00007ffff621ac5b in driver::driver::phase_3_run_analysis_passes::_1b99c65643aa108b::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#35 0x00007ffff6220904 in driver::driver::compile_input::_4c53e9c6f69a01::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#36 0x00007ffff625c637 in run_compiler::_0184613adfc5db9::_0$x2e8$x2dpre ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#37 0x00007ffff62984ea in main::anon::expr_fn_101643 ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#38 0x00007ffff629248c in monitor::anon::expr_fn_101401 ()
   from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#39 0x00007ffff627fe06 in task::__extensions__::try_100268::anon::expr_fn_100686---Type <return> to continue, or q <return> to quit---
 () from /home/ermolovd/.local/bin/../lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.so
#40 0x00007ffff778baf7 in task::spawn::spawn_raw_oldsched::make_child_wrapper::anon::expr_fn_22464 ()
   from /home/ermolovd/.local/bin/../lib/libstd-6c65cf4b443341b1-0.8-pre.so
#41 0x00007ffff50900fb in task_start_wrapper (a=0x7ffff15f8820)
    at /home/ermolovd/workspace/rust/src/rt/rust_task.cpp:162
#42 0x0000000000000000 in ?? ()

bors added a commit that referenced this issue Oct 8, 2013
When `specialize`ing struct-like enum patterns, compare struct fields to
pattern fields, not pattern fields to pattern fields.

Closes #8351.
@bors bors closed this as completed in da7f411 Oct 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants