Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix both branches dead from bot address in array #1233

Merged
merged 5 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/cdomain/value/cdomains/valueDomain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,8 @@ struct
| TComp ({cstruct=false; _},_) -> Union (Unions.top ())
| TArray (ai, length, _) ->
let typAttr = typeAttrs ai in
let can_recover_from_top = ArrayDomain.can_recover_from_top (ArrayDomain.get_domain ~varAttr ~typAttr) in
let len = array_length_idx (IndexDomain.top ()) length in
Array (CArrays.make ~varAttr ~typAttr len (if can_recover_from_top then (top_value ai) else (bot_value ai)))
Array (CArrays.make ~varAttr ~typAttr len (top_value ai))
| TNamed ({ttype=t; _}, _) -> top_value ~varAttr t
| _ -> Top

Expand Down
17 changes: 17 additions & 0 deletions tests/regression/00-sanity/41-both_branches-2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// PARAM: --disable sem.unknown_function.invalidate.globals
#include <goblint.h>
struct S {
int *f[1];
};

int main() {
struct S* s;
s = magic();

int *p = s->f[0];
if (p)
__goblint_check(1); // reachable
else
__goblint_check(1); // reachable
return 0;
}
4 changes: 2 additions & 2 deletions tests/regression/03-practical/31-zstd-cctxpool-blobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ int main() {
ZSTDMT_CCtxPool* const cctxPool = calloc(1, sizeof(ZSTDMT_CCtxPool));
cctxPool->cctx[0] = malloc(sizeof(ZSTD_CCtx));
if (!cctxPool->cctx[0]) // TODO NOWARN
__goblint_check(1); // TODO reachable
__goblint_check(1); // reachable
else
__goblint_check(1); // TODO reachable
__goblint_check(1); // reachable
return 0;
}
Loading