goto-symex/slice: never slice CPROVER string-refinement intrinsics#9132
goto-symex/slice: never slice CPROVER string-refinement intrinsics#9132tautschnig wants to merge 1 commit into
Conversation
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>
There was a problem hiding this comment.
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_*, andcprover_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.
| 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; |
| if( | ||
| id.rfind("cprover_string_", 0) == 0 || | ||
| id.rfind("cprover_char_", 0) == 0 || | ||
| id.rfind("cprover_associate_", 0) == 0) | ||
| return true; |
| 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()); |
| if(contains_string_refinement_intrinsic(SSA_step.ssa_rhs)) | ||
| { | ||
| get_symbols(SSA_step.ssa_rhs); | ||
| return; | ||
| } |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
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.