You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<malloc.h>#include<assert.h>structFoo
{
inti;
chardata[1];
};
intmain()
{
structFoo*foo=malloc(sizeof(structFoo) +sizeof(char)*2);
assert(foo);
foo->data[0]='a';
assert(foo->data[0]=='a'); // always succeedsfoo->data[1]='b'; // set data[1]assert(foo->data[1]=='b'); // check data[1] -- should succeedfoo->data[2]='c'; // set data[2]assert(foo->data[1]=='b'); //check data[1] again (same test, but fails)return0;
}
CBMC version: 5.12 (develop)
Operating system: ubuntu 18.04
Exact command line resulting in the issue: $> cbmc main.c
What behaviour did you expect: all assert succed
What happened instead: the last assert fails
We already have a regression test (cbmc/Pointer_byte_extract5) that expoits the undefined behaviour (originating from SV-COMP), so I guess if we want to keep it around we should fix it properly.
The text was updated successfully, but these errors were encountered:
will be squashed.
Note: this also introduces some new overflow checks. Also the pre-structhack in
test `cbmc/Pointer_byte_extract5` no longer works with `--no-simplify`. But as
the issue diffblue#5213 shows, CBMC has a much bigger problem with that. So we propose
the rewrite the test to use the standard, flexible-array, approach.
I've tagged this "wontfix" for now and will leave it open for documentation purposes: This test works fine when using an array of size zero or leaving the array size unspecified (making it a proper flexible array member).
CBMC version: 5.12 (develop)
Operating system: ubuntu 18.04
Exact command line resulting in the issue:
$> cbmc main.c
What behaviour did you expect: all assert succed
What happened instead: the last assert fails
We already have a regression test (
cbmc/Pointer_byte_extract5
) that expoits the undefined behaviour (originating from SV-COMP), so I guess if we want to keep it around we should fix it properly.The text was updated successfully, but these errors were encountered: