From e0f7243523bca0fb34a71d7f501899162d5ccaf1 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Wed, 8 Mar 2017 19:43:24 -0800 Subject: [PATCH] Handle a half-full func.locations map. If func.locations has not been properly resized to have an entry for all values, we should just full in the default location for the missing values instead of crashing. --- lib/cretonne/src/write.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cretonne/src/write.rs b/lib/cretonne/src/write.rs index 40b625d6e0..b0ef3a03d3 100644 --- a/lib/cretonne/src/write.rs +++ b/lib/cretonne/src/write.rs @@ -186,7 +186,9 @@ fn write_instruction(w: &mut Write, if !func.locations.is_empty() { let regs = isa.register_info(); for r in func.dfg.inst_results(inst) { - write!(s, ",{}", func.locations[r].display(®s))? + write!(s, + ",{}", + func.locations.get(r).cloned().unwrap_or_default().display(®s))? } } write!(s, "]")?;