From c329b4ff11bc02bd7c78e81a1060509132e94ac5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 10 Oct 2023 17:31:48 -0400
Subject: [PATCH] Bytecode: fix bug in print_bytecode_{static,dynamic}_model
 commands

The FENDEQU tag was not properly handled when printing.
---
 mex/sources/bytecode/Evaluate.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mex/sources/bytecode/Evaluate.cc b/mex/sources/bytecode/Evaluate.cc
index 0fde22de0d..b7a3594716 100644
--- a/mex/sources/bytecode/Evaluate.cc
+++ b/mex/sources/bytecode/Evaluate.cc
@@ -968,9 +968,9 @@ Evaluate::print_expression(const Evaluate::it_code_type &expr_begin, const optio
           go_on = false;
           break;
         case Tags::FENDBLOCK:
+          throw FatalException{"Can't print FENDBLOCK"};
         case Tags::FENDEQU:
-          go_on = false;
-          break;
+          throw FatalException{"Can't print FENDEQU"};
         default:
           throw FatalException{"In print_expression, unknown opcode "
                                + to_string(static_cast<int>((*it_code)->op_code))};
@@ -2242,6 +2242,8 @@ Evaluate::printCurrentBlock()
     {
       if ((*it_code)->op_code == Tags::FENDBLOCK)
         go_on = false;
+      else if ((*it_code)->op_code == Tags::FENDEQU)
+        it_code++;
       else
         {
           string s;
-- 
GitLab