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 2 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
2 changes: 1 addition & 1 deletion src/cdomains/valueDomain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ struct
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 (if can_recover_from_top then (top_value ai) else Bot))
sim642 marked this conversation as resolved.
Show resolved Hide resolved
| 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;
}
Loading