Skip to content

Fix Clang Static Analyzer null dereference warning in mesh_device_view.cpp#38710

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-null-dereference-issue-again
Draft

Fix Clang Static Analyzer null dereference warning in mesh_device_view.cpp#38710
Copilot wants to merge 2 commits intomainfrom
copilot/fix-null-dereference-issue-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 27, 2026

Ticket

N/A

Problem description

Clang Static Analyzer reports core.NullDereference at line 262 in mesh_device_view.cpp. Lambda get_neighbors captures structured binding variables (num_rows, num_cols) via [&], which the analyzer flags as potentially unsafe.

What's changed

Changed lambda capture from capture-all-by-reference to explicit capture-by-value:

// Before
auto get_neighbors = [&](const MeshCoordinate& coord) -> std::vector<MeshCoordinate> {

// After  
auto get_neighbors = [num_rows, num_cols](const MeshCoordinate& coord) -> std::vector<MeshCoordinate> {

Single-line change eliminates analyzer warning with zero functional impact.

Checklist

  • All post-commit tests
  • Blackhole Post commit
  • cpp-unit-tests
  • New/Existing tests provide coverage for changes

Model tests

If your changes cover model-related code, you should run tests corresponding to affected models and platforms (Single card, T3K, Galaxy). "Choose your pipeline" workflows facilitate running multiple kinds of tests in a single run. Each offers models-mandatory and models-extended presets.
The former includes a minimal set of tests, to be run always. The latter extends that with additional ones - use your best judgement in deciding which is the most appropriate for your PR.

Original prompt

Fix this Clang Static Analyzer issue:

  • core.NullDereference in tt_metal/distributed/mesh_device_view.cpp:262 — Dereference of undefined pointer value

Verify it's a real issue, apply minimal fix, follow coding standards.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…w.cpp

Changed lambda capture from capture-all-by-reference [&] to explicit
capture-by-value [num_rows, num_cols] to avoid potential undefined
behavior with structured binding variables.

Co-authored-by: blozano-tt <[email protected]>
Copilot AI changed the title [WIP] Fix null dereference in mesh_device_view Fix Clang Static Analyzer null dereference warning in mesh_device_view.cpp Feb 27, 2026
blozano-tt added a commit that referenced this pull request Mar 1, 2026
The workflow has been reporting failures since Feb 26 when the GitHub
Actions runner image updated from gh CLI 2.86.0 to 2.87.3.

gh CLI v2.87.0 introduced API version pinning (X-GitHub-Api-Version:
2022-11-28) which broke the Copilot API (CAPI) log streaming endpoint
(cli/cli#12729, cli/cli#12730). The fix in cli/cli#12731 corrected the
API version for CAPI requests, but the --follow flag still exits
non-zero with 'not found' when streaming session logs.

Crucially, the agent task itself succeeds — every 'failing' run since
Feb 26 actually created a PR:
  Feb 26 06:20 → #38614
  Feb 26 08:18 → #38615
  Feb 27 06:16 → #38710
  Feb 27 08:17 → #38723
  Feb 28 08:09 → #38828

But because of 'set -euo pipefail', the non-zero --follow exit code
killed the script before the PR labeling code could run.

Fix: tolerate --follow failures with '|| echo warning', allowing the
script to continue to extract the PR number and apply labels.
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