Skip to content

Fix types of unavailable SMT array model values - #9161

Open
chaizhenhua wants to merge 1 commit into
diffblue:developfrom
chaizhenhua:fix/smt-typed-unknown-array-20260910-upstream
Open

chaizhenhua wants to merge 1 commit into
diffblue:developfrom
chaizhenhua:fix/smt-typed-unknown-array-20260910-upstream

Conversation

@chaizhenhua

Copy link
Copy Markdown

Array model reconstruction currently uses nil expressions for missing defaults
and unavailable parsed elements. Selecting one of those elements while building
a counterexample trace loses the array element type and violates simplification's
type-preservation postcondition.

Use typed unknown expressions at those two existing reconstruction points, as
the bitvector array reader already does. The change does not invent concrete
values or alter constraints, SAT results, known defaults/stores, zero lengths,
unknown sizes, or nonconstant-index handling. The additional unit dependencies
only exercise the real parser-to-JSON trace boundary.

Validation includes eleven cause/effect unit sections, SMT2/Z3/CORE unit tests,
cbmc-CORE, seven array/VLA regressions through Z3, and a real JSON
counterexample trace. Reverting the two production expressions reproduces the
type-preservation postcondition failure; restoring them rebuilds and passes the
focused, SMT2, and CORE suites.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures: none added.
  • User guide: not applicable; this restores the existing typed model contract.
  • Regression and unit tests are included in the bug-fix commit.
  • Performance data: not applicable; no performance claim.
  • Restricted to one bug fix.
  • No unrelated whitespace changes.

Array model reconstruction currently uses nil expressions for missing
defaults and unavailable parsed elements. Selecting one of these elements
during counterexample trace simplification loses the array element type
and violates simplify_rec's type-preservation postcondition.

Use typed unknown expressions, as the bitvector array model reader already
does, without inventing concrete values or changing solver constraints.
Keep known defaults/stores, zero lengths, unknown sizes and the existing
nonconstant-index handling unchanged.

Extend the existing array-model test helper and exercise the actual JSON
declaration exporter. The additional unit-module dependencies are only for
this parser-to-trace regression; production dependencies are unchanged.
The eleven cause/effect cases include missing/default/store values and
compatibility with skipped nonconstant indices. Reverting the production
change reproduces the simplify_rec postcondition failure (SIGABRT).

Validation on develop 820ff0f:
- Focused regression: 104 assertions; SMT2: 295 assertions / 40 cases.
- Z3 unit tests: 22 assertions / 6 cases.
- CORE unit: 592 cases / 18911 assertions, including 2 expected failures.
- CBMC CORE: 1128 passed, 67 excluded by the existing profile.
- Seven array/VLA Z3 regressions and a real JSON counterexample trace.
- Restored fix rebuilt and focused, SMT2 and CORE unit suites passed.
- clang-format 18 changed-line check and upstream diff cpplint passed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant