Skip to content

Commit e18d93d

Browse files
Merge pull request #1721 from goblint/issue_1719_followup
Fallback for malloc uniqueness for when threading analyses are disabled
2 parents 8f84f7c + 30eef52 commit e18d93d

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/analyses/wrapperFunctionAnalysis.ml

+4-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ module MallocWrapper : MCPSpec = struct
174174
| Some (t, _, c) -> UniqueCount.is_top c ||
175175
(match t with
176176
| `Lifted tid -> not (Thread.is_unique tid)
177-
| _ -> true)
177+
| _ ->
178+
(* The thread analysis may be completely disabled; in this case we fall back on checking whether the program has been single threaded since start *)
179+
not (man.ask (Q.MustBeSingleThreaded {since_start = true}))
180+
)
178181
| None -> false
179182
end
180183
| _ -> Queries.Result.top q
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// PARAM: --set ana.malloc.unique_address_count 1 --set ana.autotune.activated '["reduceAnalyses"]' --enable ana.autotune.enabled
2+
#include<pthread.h>
3+
#include<goblint.h>
4+
5+
int main(int argc, char *argv[]) {
6+
int* ptr = (int*)malloc(sizeof(int));
7+
*ptr = 8;
8+
*ptr = 5;
9+
10+
__goblint_check(*ptr ==5);
11+
12+
return 0;
13+
}

0 commit comments

Comments
 (0)