[impurity] Suppress internal error with too strong assumption

Summary:
The impurity checker assumed that in pulse summary, all key addresses of PRE state should exist in
POST state.  However, the assumption is not always true.  For example,

```
void foo(int x) {
  int y = x;
  // HERE
}
```

At `HERE`, pulse's summary is

```
POST={
  roots={ &x=v1 };
  mem  ={ v1 -> { * -> v4 } };
}
PRE={
  roots={ &x=v1 };
  mem  ={ v1 -> { * -> v4 },
          v4 -> { } };
}
```

The `v4` entry exists only at `PRE`.  Although the `v4` entry is luckily removed in the summary by
the canonicalization in this example, basically there is no guarantee about the entry sets of PRE and POST.

Reviewed By: jvillard

Differential Revision: D26550338

fbshipit-source-id: 99a31cd43
master
Sungkeun Cho 4 years ago committed by Facebook GitHub Bot
parent 96b8558b08
commit 02933d81ba

@ -84,12 +84,12 @@ let add_to_modified pname ~pvar ~access ~addr pre_heap post modified_vars =
| None, None -> | None, None ->
aux (access_list, modified_vars) ~addr_to_explore ~visited aux (access_list, modified_vars) ~addr_to_explore ~visited
| Some _, None -> | Some _, None ->
L.die InternalError L.debug Analysis Verbose
"It is unexpected to have an address which has a binding in pre but not in post!@\n\ "%a is in the pre but not the post of the call to %a@\n\
%a is in the pre but not the post of the call to %a@\n\
callee heap pre: @[%a@]@\n\ callee heap pre: @[%a@]@\n\
callee post: @[%a@]@\n" callee post: @[%a@]@\n"
AbstractValue.pp addr Procname.pp pname BaseMemory.pp pre_heap BaseDomain.pp post AbstractValue.pp addr Procname.pp pname BaseMemory.pp pre_heap BaseDomain.pp post ;
aux (access_list, modified_vars) ~addr_to_explore ~visited
| None, Some (_, attrs_post) -> | None, Some (_, attrs_post) ->
aux aux
(add_invalid_and_modified ~pvar ~access ~check_empty:false attrs_post access_list (add_invalid_and_modified ~pvar ~access ~check_empty:false attrs_post access_list

Loading…
Cancel
Save