File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,19 +51,27 @@ predicate allocExprOrIndirect(Expr alloc, string kind) {
5151 )
5252}
5353
54+ /**
55+ * Holds if `v` is assigned value `e`, and `e` is not known to be `0`.
56+ */
57+ private predicate nonNullGlobalAssignment ( Variable v , Expr e ) {
58+ not v instanceof LocalScopeVariable and
59+ v .getAnAssignedValue ( ) = e and
60+ not e .getValue ( ) .toInt ( ) = 0
61+ }
62+
5463/**
5564 * Holds if `v` is a non-local variable which is assigned only with allocations of
5665 * type `kind` (it may also be assigned with NULL).
5766 */
5867private predicate allocReachesVariable ( Variable v , Expr alloc , string kind ) {
59- not v instanceof LocalScopeVariable and
6068 exists ( Expr mid |
61- v . getAnAssignedValue ( ) = mid and
69+ nonNullGlobalAssignment ( v , mid ) and
6270 allocReaches ( mid , alloc , kind )
63- ) and forall ( Expr mid |
64- v . getAnAssignedValue ( ) = mid |
65- allocReaches ( mid , _ , kind ) or
66- mid . getValue ( ) . toInt ( ) = 0 // NULL
71+ ) and
72+ forall ( Expr mid |
73+ nonNullGlobalAssignment ( v , mid ) |
74+ allocReaches ( mid , _ , kind )
6775 )
6876}
6977
You can’t perform that action at this time.
0 commit comments