From e49e7e906f5c4d4dd2bae203b4c611d2aead0ce7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 25 Mar 2022 12:36:36 +0100
Subject: [PATCH] =?UTF-8?q?Forbid=20changing=20the=20value=20of=20?=
 =?UTF-8?q?=E2=80=9Cslowc=E2=80=9D=20if=20=E2=80=9Cblock=E2=80=9D=20or=20?=
 =?UTF-8?q?=E2=80=9Cbytecode=E2=80=9D=20is=20used?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The code is buggy and leads to wrong results, so forbid this combination.
---
 .../perfect_foresight_solver_core.m                        | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/matlab/perfect-foresight-models/perfect_foresight_solver_core.m b/matlab/perfect-foresight-models/perfect_foresight_solver_core.m
index 7cc039d6b3..13bfed9a8c 100644
--- a/matlab/perfect-foresight-models/perfect_foresight_solver_core.m
+++ b/matlab/perfect-foresight-models/perfect_foresight_solver_core.m
@@ -11,7 +11,7 @@ function [oo_, maxerror] = perfect_foresight_solver_core(M_, options_, oo_)
 % - oo_                 [struct] contains results
 % - maxerror            [double] contains the maximum absolute error
 
-% Copyright (C) 2015-2021 Dynare Team
+% Copyright (C) 2015-2022 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -47,6 +47,11 @@ if options_.linear && (isequal(options_.stack_solve_algo, 0) || isequal(options_
     options_.linear_approximation = true;
 end
 
+if options_.slowc != 1 && (options_.block || options_.bytecode)
+    % The code is buggy and leads to wrong results, so forbid this combination
+    error('Changing the value of the slowc option is not supported with block and/or bytecode option')
+end
+
 if options_.block
     if options_.bytecode
         try
-- 
GitLab