From 65e18fe8834b31a885667e0e498e3a2ff0f1f47a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 1 Mar 2022 11:27:56 +0100 Subject: [PATCH] Bytecode: fix stack_solve_algo=4 on linear blocks Only one iteration is performed on linear blocks. But in the case of stack_solve_algo=4 it is not enough, since it will not find the right optimal path lenght at the first iteration (even though that optimal path length is ufnitary). --- mex/sources/bytecode/Interpreter.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mex/sources/bytecode/Interpreter.cc b/mex/sources/bytecode/Interpreter.cc index 8fe3a141f..d7bc98326 100644 --- a/mex/sources/bytecode/Interpreter.cc +++ b/mex/sources/bytecode/Interpreter.cc @@ -429,7 +429,10 @@ Interpreter::simulate_a_block(const vector_table_conditional_local_type &vector_ test_mxMalloc(y_save, __LINE__, __FILE__, __func__, y_size*sizeof(double)*(periods+y_kmax+y_kmin)); start_code = it_code; iter = 0; - if (!is_linear) + if (!is_linear + || stack_solve_algo == 4) // On linear blocks, stack_solve_algo=4 may + // need more than one iteration to find the + // optimal (unitary!) path length { cvg = false; glambda2 = g0 = very_big;