Skip to content

Commit 2b98818

Browse files
authored
Merge pull request #1233 from goblint/concrat-both-branches
Fix both branches dead from bot address in array
2 parents 96a57a2 + 3c99385 commit 2b98818

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

src/cdomain/value/cdomains/valueDomain.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,8 @@ struct
204204
| TComp ({cstruct=false; _},_) -> Union (Unions.top ())
205205
| TArray (ai, length, _) ->
206206
let typAttr = typeAttrs ai in
207-
let can_recover_from_top = ArrayDomain.can_recover_from_top (ArrayDomain.get_domain ~varAttr ~typAttr) in
208207
let len = array_length_idx (IndexDomain.top ()) length in
209-
Array (CArrays.make ~varAttr ~typAttr len (if can_recover_from_top then (top_value ai) else (bot_value ai)))
208+
Array (CArrays.make ~varAttr ~typAttr len (top_value ai))
210209
| TNamed ({ttype=t; _}, _) -> top_value ~varAttr t
211210
| _ -> Top
212211

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// PARAM: --disable sem.unknown_function.invalidate.globals
2+
#include <goblint.h>
3+
struct S {
4+
int *f[1];
5+
};
6+
7+
int main() {
8+
struct S* s;
9+
s = magic();
10+
11+
int *p = s->f[0];
12+
if (p)
13+
__goblint_check(1); // reachable
14+
else
15+
__goblint_check(1); // reachable
16+
return 0;
17+
}

tests/regression/03-practical/31-zstd-cctxpool-blobs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ int main() {
2222
ZSTDMT_CCtxPool* const cctxPool = calloc(1, sizeof(ZSTDMT_CCtxPool));
2323
cctxPool->cctx[0] = malloc(sizeof(ZSTD_CCtx));
2424
if (!cctxPool->cctx[0]) // TODO NOWARN
25-
__goblint_check(1); // TODO reachable
25+
__goblint_check(1); // reachable
2626
else
27-
__goblint_check(1); // TODO reachable
27+
__goblint_check(1); // reachable
2828
return 0;
2929
}

0 commit comments

Comments
 (0)