You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Paralegal doesn't correctly propagate control flow relations when match statements are involved.
This is causing the Atomic property to fail: the add_resource_opts call here does not see the control-flow influence from the check_write call here due to the fact that it is wrapped in an if let.
Consider the following minimal examples:
#[paralegal::analyze]pubfnminimal_match(&self,i:AtomicResult<i64>,j:i64,k:bool){ifself.is_ok(j).is_ok(){matchSome(k){Some(k) => self.store(j),None => (),};}}#[paralegal::analyze]pubfnminimal_no_match(&self,i:AtomicResult<i64>,j:i64,k:bool){ifself.is_ok(j).is_ok(){if k {self.store(j);}}}
We expect that in both examples is_ok has control-flow influence on store. However, these are the corresponding graphs:
With match, there is no control-flow influence anywhere.
Here is the MIR for the code with the match -- I believe the control-flow influence is there, but it's not captured in our SPDG. minimal_match.mir.gv.pdf
The text was updated successfully, but these errors were encountered:
Paralegal doesn't correctly propagate control flow relations when match statements are involved.
This is causing the Atomic property to fail: the
add_resource_opts
call here does not see the control-flow influence from thecheck_write
call here due to the fact that it is wrapped in anif let
.Consider the following minimal examples:
We expect that in both examples
is_ok
has control-flow influence onstore
. However, these are the corresponding graphs:With match:
minimal_match_76201e.inlined-pruned.gv.pdf
Without match:
minimal_no_let_a24bcc.inlined-pruned.gv.pdf
With match, there is no control-flow influence anywhere.
Here is the MIR for the code with the match -- I believe the control-flow influence is there, but it's not captured in our SPDG.
minimal_match.mir.gv.pdf
The text was updated successfully, but these errors were encountered: