Closed
Description
CBMC version: cbmc-5.11, cbmc-5.11-1479-ga86978840
Operating system: Linux 4.15.0-45-generic x86_64 GNU/Linux
Exact command line resulting in the issue: cbmc ccb.c , cbmc ccb.c --smt2
What behaviour did you expect: all 4 assertions should pass
What happened instead: 2 assertions fail (SAT backend), CBMC crash (smt2 backend)
In the following code all assertions should be true:
#include <assert.h>
struct St {
char c;
int d[];
};
struct St s = {'a', {11, 5}};
int main () {
unsigned char c;
c = c && 1;
assert(c==0 || c==1);
assert(s.d[1]==5);
s.d[1] += c;
assert(s.d[1]<8);
assert(s.d[0]==11);
}
With cbmc, the behavior depends on the solver backend. With the default SAT solver backend, assertions 3 and 4 are failing for both cbmc-5.11 and cbmc-5.11-1479-ga86978840:
** Results:
ccb.c function main
[main.assertion.1] line 11 assertion c==0 || c==1: SUCCESS
[main.assertion.2] line 12 assertion s.d[1]==5: SUCCESS
[main.assertion.3] line 14 assertion s.d[1]<8: FAILURE
[main.assertion.4] line 15 assertion s.d[0]==11: FAILURE
With the smt2 backend, cbmc crashes. With cbmc-5.11 the error message is:
converting SSA
cannot unpack struct with non-byte aligned components
With cbmc-5.11-1479-ga86978840 from the develop branch (rev a869788), the error message is:
converting SSA
map::at