From 67fa81ce9c8d856d0e6d5fb1cf14060d11f7867f Mon Sep 17 00:00:00 2001 From: Andrei Maiboroda Date: Mon, 20 Jul 2020 20:58:15 +0200 Subject: [PATCH] Remove redundant check from drop_operand --- lib/fizzy/parser_expr.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/fizzy/parser_expr.cpp b/lib/fizzy/parser_expr.cpp index 6870b55ab..e269cad43 100644 --- a/lib/fizzy/parser_expr.cpp +++ b/lib/fizzy/parser_expr.cpp @@ -119,8 +119,11 @@ inline void drop_operand( static_cast(operand_stack.size()) < frame.parent_stack_height + 1) throw validation_error{"stack underflow"}; - if (frame.unreachable && static_cast(operand_stack.size()) == frame.parent_stack_height) + if (static_cast(operand_stack.size()) == frame.parent_stack_height) + { + assert(frame.unreachable); // implied from stack underflow check above return; + } const auto actual_type = operand_stack.pop(); if (expected_type.has_value() && actual_type != *expected_type)