Skip to content

goto_inline: handle arguments of a type that differs from the parameter's - #9453

Open
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:up/inline
Open

tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:up/inline

Conversation

@tautschnig

Copy link
Copy Markdown
Collaborator

Depends-on: #9452

The inliner failed an UNREACHABLE when an argument could not be converted
to the type of the parameter it binds to: it converted only pointers to
pointers, arrays to pointers, and integers or Booleans to integers or
Booleans. Other mismatches arise whenever a function is called without a
prototype in scope, e.g. with an enum or floating-point argument, so
goto-instrument --inline aborted on such programs.

Symbolic execution handles the same calls in
goto_symext::parameter_assignments: it reinterprets the bits of integer,
bit-field, enum, Boolean, pointer and union arguments bound to parameters
of those types, and rejects any other mismatch. Do the same in the
inliner, so that inlining does not change the verification result, and
use a non-deterministic value, with a warning, for the mismatches that
symbolic execution rejects, as the inliner already does for a missing
argument.

DFCC's loop-assigns inference reaches the latter: it inlines the callees
of a function with loop contracts before that function's calls are
instrumented, so a callee that already has its write set parameter is
inlined against the original arguments. For a variadic callee, a
variadic argument then binds to a declared parameter.

Tests:

  • goto-instrument/inline_19: an enum argument gives the same result as
    without inlining, and a double argument bound to an int parameter is
    replaced by a non-deterministic value;
  • contracts-dfcc/loop_contracts_variadic_callee_inference: the DFCC case.

Co-authored-by: Kiro kiro-agent@users.noreply.github.com

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a 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.

Copilot AI balanced review requested due to automatic review settings November 12, 2026 00:36

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.30%. Comparing base (3e1f386) to head (97ebcce).
⚠️ Report is 5 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #9453   +/-   ##
========================================
  Coverage    81.29%   81.30%           
========================================
  Files         1725     1725           
  Lines       191680   191703   +23     
  Branches        73       73           
========================================
+ Hits        155835   155866   +31     
+ Misses       35845    35837    -8     

☔ 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.

The inliner failed an UNREACHABLE when an argument could not be
converted to the type of the parameter it binds to: it converted only
pointers to pointers, arrays to pointers, and integers or Booleans to
integers or Booleans. Other mismatches arise whenever a function is
called without a prototype in scope, e.g. with an enum or
floating-point argument, so goto-instrument --inline aborted on such
programs.

Symbolic execution handles the same calls in
goto_symext::parameter_assignments: it reinterprets the bits of
integer, bit-field, enum, Boolean, pointer and union arguments bound to
parameters of those types, and rejects any other mismatch. Do the same
in the inliner for the cases it did not handle so far, so that inlining
does not change the verification result, and use a non-deterministic
value, with a warning, for the mismatches that symbolic execution
rejects, as the inliner already does for a missing argument.

DFCC's loop assigns inference inlines the callees of a function with
loop contracts before the function's calls are instrumented, and adds a
placeholder argument for the write set parameter of callees that have
already been instrumented. Without the placeholder, the arguments bind
to the wrong parameters, which so far made the inliner fail an
invariant. As the inliner now tolerates the mismatch, a missing
placeholder would no longer be noticed by any regression test.

Tests:
- goto-instrument/inline_19 checks that an enum argument gives the same
  result as without inlining, and that a double argument bound to an
  int parameter is replaced by a non-deterministic value;
- contracts-dfcc/loop_assigns_inference_write_set_placeholder makes the
  shifted arguments observable: without the placeholder, &a binds to the
  write set parameter of printf and 0 to p, so that the inferred loop
  assigns miss a and the assigns check of *p fails.

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants