Skip to content

CBMC smybolic execution soundness issue; backwards goto missed in do ... while loop #5450

@andreast271

Description

@andreast271

CBMC version: 5.12 (cbmc-5.12.6-17-g7d30335)
Operating system: GNU/Linux x86_64
Exact command line resulting in the issue: cbmc top.c
What behaviour did you expect: VERIFICATION SUCCESSFUL
What happened instead: VERIFICATION FAILED

Test case top.c:

#include "assert.h"
int main()
{
   int count = 0;
   do { 
     count = count +1 ; 
   } while(count < 5);

   assert(count == 5);
   assert(count == 17);
}

The first assertion should pass, the second should fail. However, CBMC reports SUCCESS for both assertions.
Looking at the program functions shows that simulating the loop is aborted via ASSUME(false) after one iteration:

cbmc top.c --program-only
[...]
// 1 file top.c line 5 function main
(36) count!0@1#2 == 0
// 2 file top.c line 7 function main
(37) count!0@1#3 == 1
// 3 file top.c line 8 function main
// 3 file top.c line 8 function main
(38) ASSUME(FALSE)

The problem is also present in cbmc-5.12.6
The last major version of CBMC where this test case works correctly is 5.7.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions