Skip to content

C++: Get rid of an unnecessary indirection lower bound in isDef - #23263

Open
MathiasVP wants to merge 2 commits into
github:mainfrom
MathiasVP:fix-array-store-indirection
Open

MathiasVP wants to merge 2 commits into
github:mainfrom
MathiasVP:fix-array-store-indirection

Conversation

@MathiasVP

Copy link
Copy Markdown
Contributor

On main we have an ugly asymmetry between isDef (which has a special-case for AarrayTypes hidden inside the getMinIndirectionsForType predicate) and isUse (which uses no such predicate).

It turns out the inclusion of this predicate in isDef was incorrect and the tests were incorrectly labeled. Luckily, fixing this asymmetry fixes the tests as well.

@MathiasVP MathiasVP added no-change-note-required This PR does not need a change note C++ labels Nov 26, 2026
@MathiasVP
MathiasVP marked this pull request as ready for review November 27, 2026 08:36
@MathiasVP
MathiasVP requested review from a team as code owners November 27, 2026 08:36
Copilot AI adaptive review requested due to automatic review settings November 27, 2026 08:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new self-edge causes offset reads to lose their constant-array sources in the quantum model, and the updated expectations accept unknown sources rather than fixing the downstream flow regression.

1 open issue
What changed in this PR

This PR aligns C++ data-flow definition handling with use handling by removing the array-specific indirection lower bound in isDef.

Changes:

  • Start definition indirections at one and adjust their indexing.
  • Correct array-flow test annotations and add a local-array regression case.
  • Update data-flow and experimental quantum expectations.
File Description
cpp/​ql/​test/​library-tests/​dataflow/​dataflow-tests/​test.cpp Corrects array-flow annotations and adds local-array coverage.
cpp/​ql/​test/​library-tests/​dataflow/​dataflow-tests/​test-source-sink.expected Updates expected source-to-sink flows for arrays.
cpp/​ql/​test/​experimental/​library-tests/​quantum/​node_edges.expected Updates source edges for offset message inputs.
cpp/​ql/​lib/​semmle/​code/​cpp/​ir/​dataflow/​internal/​SsaImplCommon.qll Removes the type-dependent lower bound from isDef.

Review effort: Balanced (adaptive)

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

C++ no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants