diff --git a/src/simulate/simulate.cpp b/src/simulate/simulate.cpp index e50f4dce6..06b5b8ba5 100644 --- a/src/simulate/simulate.cpp +++ b/src/simulate/simulate.cpp @@ -657,9 +657,13 @@ namespace das while ( cond->evalBool(context) && !context.stopFlags ) { SimNode ** __restrict body = list; loopbegin:; - for (; body!=tail; ++body) { - (*body)->eval(context); - DAS_PROCESS_LOOP_FLAGS(break); + if (body!=tail) { + for (; body!=tail; ++body) { + (*body)->eval(context); + DAS_PROCESS_LOOP_FLAGS(break); + } + } else { + DAS_KEEPALIVE_LOOP(&context); } } loopend:; @@ -676,10 +680,14 @@ namespace das while ( cond->evalBool(context) && !context.stopFlags ) { SimNode ** __restrict body = list; loopbegin:; - for (; body!=tail; ++body) { - DAS_SINGLE_STEP(context,(*body)->debugInfo,true); - (*body)->eval(context); - DAS_PROCESS_LOOP_FLAGS(break); + if (body!=tail) { + for (; body!=tail; ++body) { + DAS_SINGLE_STEP(context,(*body)->debugInfo,true); + (*body)->eval(context); + DAS_PROCESS_LOOP_FLAGS(break); + } + } else { + DAS_KEEPALIVE_LOOP(&context); } } loopend:;