diff --git a/matlab/perfect-foresight-models/perfect_foresight_solver_core.m b/matlab/perfect-foresight-models/perfect_foresight_solver_core.m
index 7cc039d6b399c0bfa3d7c62ade91cd85a82b75e2..13bfed9a8c31786731a72fe9290a85a0eb978331 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