about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-04-18 10:58:42 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2021-04-18 10:58:42 +0200
commitbf85572f59f5b70d73869c3902964c5ca47668df (patch)
tree4df5a1a65d3984ca17e39c0a5420cf76ba2f80f2
parente01de0f58df96c09d6b9da53e913af6bdb0142c0 (diff)
downloadrust-bf85572f59f5b70d73869c3902964c5ca47668df.tar.gz
rust-bf85572f59f5b70d73869c3902964c5ca47668df.zip
Extend Termination::report return value as necessary
-rw-r--r--src/main_shim.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main_shim.rs b/src/main_shim.rs
index 3305ca6f6eb..713cf4ebdc0 100644
--- a/src/main_shim.rs
+++ b/src/main_shim.rs
@@ -113,7 +113,12 @@ pub(crate) fn maybe_create_entry_wrapper(
                 // FIXME do proper abi handling instead of expecting the pass mode to be identical
                 // for returns and arguments.
                 let report_call_inst = bcx.ins().call(report_func_ref, &call_results);
-                bcx.func.dfg.inst_results(report_call_inst)[0]
+                let res = bcx.func.dfg.inst_results(report_call_inst)[0];
+                match m.target_config().pointer_type() {
+                    types::I32 => res,
+                    types::I64 => bcx.ins().sextend(types::I64, res),
+                    _ => unimplemented!("16bit systems are not yet supported"),
+                }
             } else if is_main_fn {
                 let start_def_id = tcx.require_lang_item(LangItem::Start, None);
                 let start_instance = Instance::resolve(