From fc374b6c068760f317696c8a72f2a893e7f4c516 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 31 Aug 2017 07:45:39 -0700 Subject: [PATCH] Test that stack layout with an unsupported offset is rejected cleanly. --- lib/cretonne/src/stack_layout.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/cretonne/src/stack_layout.rs b/lib/cretonne/src/stack_layout.rs index f968e56a07..c367849096 100644 --- a/lib/cretonne/src/stack_layout.rs +++ b/lib/cretonne/src/stack_layout.rs @@ -111,6 +111,8 @@ mod tests { use ir::StackSlots; use ir::types; use super::layout_stack; + use ir::stackslot::StackOffset; + use result::CtonError; #[test] fn layout() { @@ -181,5 +183,9 @@ mod tests { assert_eq!(sss[ss0].offset, -16); assert_eq!(sss[ss1].offset, -8); assert_eq!(sss[out0].offset, 0); + + // Also test that an unsupported offset is rejected. + sss.get_outgoing_arg(types::I8, StackOffset::max_value() - 1); + assert_eq!(layout_stack(sss, 1), Err(CtonError::ImplLimitExceeded)); } }