From 681cb5e20abfa7ffb186a22adaeb4666d8113406 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 6 Nov 2018 12:08:34 -0800 Subject: [PATCH] Assert that the non-fixed inputs to return match the function's signature. --- lib/codegen/src/regalloc/spilling.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/codegen/src/regalloc/spilling.rs b/lib/codegen/src/regalloc/spilling.rs index 132c98be92..1ce0649fed 100644 --- a/lib/codegen/src/regalloc/spilling.rs +++ b/lib/codegen/src/regalloc/spilling.rs @@ -348,6 +348,11 @@ impl<'a> Context<'a> { // Similarly, for return instructions, collect uses of ABI-defined // return values. if self.cur.func.dfg[inst].opcode().is_return() { + debug_assert_eq!( + self.cur.func.dfg.inst_variable_args(inst).len(), + self.cur.func.signature.returns.len(), + "The non-fixed arguments in a return should follow the function's signature." + ); for (ret_idx, (ret, &arg)) in self.cur.func.signature.returns.iter().zip(args).enumerate() {