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

Refactor writing to pointers #1531

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Do not remove UnknownPtr from address set before running `reachable…
…_vars`
  • Loading branch information
karoliineh committed Jul 1, 2024
commit a30fbfc3add97d40d400bce360f9cb821439f35e
10 changes: 3 additions & 7 deletions src/analyses/base.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1486,13 +1486,9 @@ struct
| Top -> Queries.Result.top q
| Bot -> Queries.Result.bot q (* TODO: remove *)
| Address a ->
let a' = AD.remove Addr.UnknownPtr a in (* run reachable_vars without unknown just to be safe: TODO why? *)
let addrs = reachable_vars ~ctx ctx.local [a'] in
let addrs' = List.fold_left (AD.join) (AD.empty ()) addrs in
if AD.may_be_unknown a then
AD.add UnknownPtr addrs' (* add unknown back *)
else
addrs'
[a]
|> reachable_vars ~ctx ctx.local
|> List.fold_left (AD.join) (AD.empty ())
| Int i ->
begin match Cilfacade.typeOf e with
| t when Cil.isPointerType t -> AD.of_int i (* integer used as pointer *)
Expand Down
Loading