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

Control-flow influence isn't captured from callsites that might result in an early error return to downstream fn calls #60

Open
JustusAdam opened this issue Sep 29, 2023 · 0 comments
Labels
bug Something isn't working flow-analysis Concerns the PDG construction component

Comments

@JustusAdam
Copy link
Collaborator

as a minimal example we have this code and the resulting flows:

#[dfpp::analyze]
  pub fn a(&self, j: i64) -> AtomicResult<i64> {
      self.is_ok()?;
      self.store(j);
      Ok(1)
  }
  fn is_ok(&self) -> AtomicResult<i64> {
      Ok(1)
  }
  fn store(&self, _j: i64) {}

// ANALYSIS RESULT
flow =
        (`a_f25633)->(
            (`cs_branch_dcd647_6afc41)->(`arg0_cs_from_residual_a0b86b_f1f843) +
            (`cs_is_ok_e6d043_6772d0)->(`arg0_cs_branch_dcd647_6afc41) +
            (`fp1_a_f25633)->(`arg1_cs_store_8c2d9d_66aa4) +
            (`cs_from_residual_a0b86b_f1f843)->(`Return) +
            (`fp0_a_f25633)->(`arg0_cs_is_ok_e6d043_6772d0 + `arg0_cs_store_8c2d9d_66aa4))
ctrl_flow =
        (`a_f25633)->(
            none->none)

but then if its not a callsite it shows up as expected, like here:

#[dfpp::analyze]
  pub fn a(&self, i: AtomicResult<i64>, j: i64) -> AtomicResult<i64> {
      i?;
      self.store(j);
      Ok(1)
  }

// ANALYSIS RESULT
flow =
      (`a_f25633)->(
          (`fp1_a_f25633)->(`arg0_cs_branch_dcd647_6772d0) +
          (`cs_from_residual_a0b86b_d03f1b)->(`Return) +
          (`cs_branch_dcd647_6772d0)->(`arg0_cs_from_residual_a0b86b_d03f1b) +
          (`fp0_a_f25633)->(`arg0_cs_store_8c2d9d_b374c0) +
          (`fp2_a_f25633)->(`arg1_cs_store_8c2d9d_b374c0))
  ctrl_flow =
      (`a_f25633)->(
          (`cs_branch_dcd647_6772d0)->(`cs_from_residual_a0b86b_d03f1b + `cs_store_8c2d9d_b374c0))

the ctrl flow should be equivalent between the two cases.

@JustusAdam JustusAdam added flow-analysis Concerns the PDG construction component bug Something isn't working labels Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flow-analysis Concerns the PDG construction component
Projects
None yet
Development

No branches or pull requests

1 participant