Skip to content

goto-symex/slice: never slice CPROVER string-refinement intrinsics#9132

Open
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:python-upstream-03-slice-string-intrinsics
Open

goto-symex/slice: never slice CPROVER string-refinement intrinsics#9132
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:python-upstream-03-slice-string-intrinsics

Conversation

@tautschnig

Copy link
Copy Markdown
Collaborator

cprover_string_* / cprover_char_* / cprover_associate_* applications carry non-data side effects into the string-refinement solver (e.g. associate_array_to_pointer is the only way the solver learns a char pointer aliases a char array). Slicing them on data dependencies alone is unsound; preserve any SSA step whose RHS contains such an intrinsic.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

cprover_string_* / cprover_char_* / cprover_associate_* applications carry
non-data side effects into the string-refinement solver (e.g.
associate_array_to_pointer is the only way the solver learns a char pointer
aliases a char array). Slicing them on data dependencies alone is unsound;
preserve any SSA step whose RHS contains such an intrinsic.

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
@tautschnig tautschnig self-assigned this Jul 23, 2026
Copilot AI review requested due to automatic review settings July 23, 2026 11:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Prevent unsound slicing by ensuring SSA assignments whose RHS contains CPROVER string-refinement intrinsics are preserved, even when their LHS is otherwise unused.

Changes:

  • Added an expression walker to detect cprover_string_*, cprover_char_*, and cprover_associate_* intrinsic applications in SSA RHS expressions.
  • Updated assignment slicing to keep (and mark dependencies of) assignments that contain those intrinsics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/goto-symex/slice.cpp
Comment on lines +39 to +46
const std::string id = id2string(to_symbol_expr(fn).get_identifier());
// Match the three intrinsic families that the string-refinement
// solver consumes side-channel information from.
if(
id.rfind("cprover_string_", 0) == 0 ||
id.rfind("cprover_char_", 0) == 0 ||
id.rfind("cprover_associate_", 0) == 0)
return true;
Comment thread src/goto-symex/slice.cpp
Comment on lines +42 to +46
if(
id.rfind("cprover_string_", 0) == 0 ||
id.rfind("cprover_char_", 0) == 0 ||
id.rfind("cprover_associate_", 0) == 0)
return true;
Comment thread src/goto-symex/slice.cpp
const auto &fn = to_function_application_expr(*it).function();
if(fn.id() != ID_symbol)
continue;
const std::string id = id2string(to_symbol_expr(fn).get_identifier());
Comment thread src/goto-symex/slice.cpp
Comment on lines +153 to +157
if(contains_string_refinement_intrinsic(SSA_step.ssa_rhs))
{
get_symbols(SSA_step.ssa_rhs);
return;
}
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 35.29412% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.82%. Comparing base (f71fdad) to head (5250217).

Files with missing lines Patch % Lines
src/goto-symex/slice.cpp 35.29% 11 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9132      +/-   ##
===========================================
- Coverage    80.83%   80.82%   -0.01%     
===========================================
  Files         1715     1715              
  Lines       189948   189965      +17     
  Branches        73       73              
===========================================
  Hits        153540   153540              
- Misses       36408    36425      +17     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants