% mmc --debug --allow-stubs -C some_bug.m % Uncaught Mercury exception: % Software Error: map.lookup: key not found % Key Type: term.var(parse_tree.prog_data.prog_var_type) % Key Value: var(10) % Value Type: ll_backend.var_locn.var_state % Stack dump follows: % 0 pred exception.throw/1-0 (erroneous) (exception.m:411) % 1 pred require.error/1-0 (erroneous) (require.m:122) % 2 pred require.report_lookup_error/3-0 (erroneous) (require.m:98) % 3 pred map.lookup/3-0 (det) (map.m:721) % 4 pred ll_backend.var_locn.actually_place_var/7-0 (det) (var_locn.m:1380) % 5 pred ll_backend.var_locn.var_locn_place_var/6-0 (det) (var_locn.m:1366) % 6 4* pred ll_backend.var_locn.actually_place_vars/5-0 (det) (var_locn.m:1361 and others) % 10 pred ll_backend.var_locn.var_locn_place_vars/5-0 (det) (var_locn.m:1353) % 11 pred ll_backend.code_info.setup_call/6-0 (det) (code_info.m:3981) % 12 pred ll_backend.call_gen.generate_call/8-0 (det) (call_gen.m:96) % 13 pred ll_backend.code_gen.generate_goal_2/7-0 (det) (code_gen.m:281) % 14 pred ll_backend.code_gen.generate_goal/5-0 (det) (code_gen.m:126) % 15 2* pred ll_backend.code_gen.generate_goals/5-0 (det) (code_gen.m:325 and others) % 17 pred ll_backend.code_gen.generate_goal_2/7-0 (det) (code_gen.m:244) % 18 pred ll_backend.code_gen.generate_goal/5-0 (det) (code_gen.m:126) % 19 2* pred ll_backend.switch_gen.generate_if_then_else_chain_cases/14-0 (det) (switch_gen.m:591 and others) % 21 pred ll_backend.switch_gen.order_and_generate_cases/13-0 (det) (switch_gen.m:283) % 22 pred ll_backend.switch_gen.generate_switch/8-0 (det) (switch_gen.m:184) % 23 pred ll_backend.code_gen.generate_goal_2/7-0 (det) (code_gen.m:262) % 24 pred ll_backend.code_gen.generate_goal/5-0 (det) (code_gen.m:126) % 25 2* pred ll_backend.code_gen.generate_goals/5-0 (det) (code_gen.m:325 and others) % 27 pred ll_backend.code_gen.generate_goal_2/7-0 (det) (code_gen.m:244) % 28 pred ll_backend.code_gen.generate_goal/5-0 (det) (code_gen.m:126) % 29 pred ll_backend.proc_gen.generate_category_code/10-0 (det) (proc_gen.m:657) % 30 pred ll_backend.proc_gen.generate_proc_code/8-0 (det) (proc_gen.m:350) % 31 pred top_level.mercury_compile_llds_back_end.llds_backend_pass_by_preds_4/12-0 (det) (mercury_compile_llds_back_end.m:383) % 32 pred top_level.mercury_compile_llds_back_end.llds_backend_pass_by_preds_3/10-0 (det) (mercury_compile_llds_back_end.m:287) % 33 pred top_level.mercury_compile_llds_back_end.llds_backend_pass_by_preds_2/10-0 (det) (mercury_compile_llds_back_end.m:258) % 34 pred top_level.mercury_compile_llds_back_end.llds_backend_pass_by_preds/7-0 (det) (mercury_compile_llds_back_end.m:207) % 35 pred top_level.mercury_compile_llds_back_end.llds_backend_pass/8-0 (det) (mercury_compile_llds_back_end.m:133) % 36 pred top_level.mercury_compile.mercury_compile_after_front_end/11-0 (det) (mercury_compile.m:1769) :- module some_bug. :- interface. :- import_module maybe. :- import_module univ. :- pred univ_named_arg_2(T::in, maybe(univ)::out) is det. :- implementation. univ_named_arg_2(Term, MaybeArgument) :- SecTagLocn = sectag_locn, ( ( SecTagLocn = stag_none, SecTag = 0 ; SecTagLocn = stag_remote, SecTag = get_remote_secondary_tag ), Arg = get_arg(Term, SecTag), type_to_univ(Arg, Univ), MaybeArgument = yes(Univ) ; SecTagLocn = stag_variable, MaybeArgument = no ). :- type sectag_locn ---> stag_none ; stag_remote ; stag_variable. :- func sectag_locn = sectag_locn. :- func get_remote_secondary_tag = int. :- some [T] func get_arg(U, int) = T.