@@ -328,13 +328,13 @@ bool BMC::visit(WhileStatement const& _node)
328
328
indicesBefore,
329
329
copyVariableIndices ()
330
330
);
331
- loopCondition = expr (_node.condition ());
331
+ loopCondition = loopCondition && expr (_node.condition ());
332
332
broke = broke || brokeInCurrentIteration;
333
333
m_loopCheckpoints.pop ();
334
334
}
335
335
}
336
336
else {
337
- smtutil::Expression loopConditionOnPreviousIteration (true );
337
+ smtutil::Expression loopConditionOnPreviousIterations (true );
338
338
for (unsigned int i = 0 ; i < bmcLoopIterations; ++i)
339
339
{
340
340
m_loopCheckpoints.emplace ();
@@ -361,13 +361,13 @@ bool BMC::visit(WhileStatement const& _node)
361
361
// breaks in current iterations are handled when traversing loop checkpoints
362
362
// handles case when the loop condition no longer holds but bmc loop iterations still unrolls the loop
363
363
mergeVariables (
364
- broke || !loopConditionOnPreviousIteration ,
364
+ broke || !loopConditionOnPreviousIterations ,
365
365
indicesBefore,
366
366
copyVariableIndices ()
367
367
);
368
368
m_loopCheckpoints.pop ();
369
369
broke = broke || brokeInCurrentIteration;
370
- loopConditionOnPreviousIteration = loopCondition;
370
+ loopConditionOnPreviousIterations = loopConditionOnPreviousIterations && loopCondition;
371
371
}
372
372
}
373
373
if (bmcLoopIterations > 0 )
@@ -384,7 +384,7 @@ bool BMC::visit(ForStatement const& _node)
384
384
385
385
smtutil::Expression broke (false );
386
386
smtutil::Expression forCondition (true );
387
- smtutil::Expression forConditionOnPreviousIteration (true );
387
+ smtutil::Expression forConditionOnPreviousIterations (true );
388
388
unsigned int bmcLoopIterations = m_settings.bmcLoopIterations .value_or (1 );
389
389
for (unsigned int i = 0 ; i < bmcLoopIterations; ++i)
390
390
{
@@ -427,13 +427,13 @@ bool BMC::visit(ForStatement const& _node)
427
427
// breaks in current iterations are handled when traversing loop checkpoints
428
428
// handles case when the loop condition no longer holds but bmc loop iterations still unrolls the loop
429
429
mergeVariables (
430
- broke || !forConditionOnPreviousIteration ,
430
+ broke || !forConditionOnPreviousIterations ,
431
431
indicesBefore,
432
432
copyVariableIndices ()
433
433
);
434
434
m_loopCheckpoints.pop ();
435
435
broke = broke || brokeInCurrentIteration;
436
- forConditionOnPreviousIteration = forCondition;
436
+ forConditionOnPreviousIterations = forConditionOnPreviousIterations && forCondition;
437
437
}
438
438
if (bmcLoopIterations > 0 )
439
439
m_context.addAssertion (not (forCondition) || broke);
0 commit comments