Skip to content

portable: Add const to local vars to suppress CPPCHECK warning - #20368

Merged
Gasoonjia merged 1 commit into
pytorch:mainfrom
vacu9708:fix-log-softmax-cppcheck-const
Jun 18, 2026
Merged

Gasoonjia merged 1 commit into
pytorch:mainfrom
vacu9708:fix-log-softmax-cppcheck-const

Conversation

@vacu9708

@vacu9708 vacu9708 commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

e93a285ebd "Extend CPPCHECK scope to portable kernels"
My work branch was cut before this new lint coverage.

Summary

CPPCHECK flagged apply_unary_map_reduce_fn<CTYPE, ACC> with a constStatement warning. This is a false positive — the code compiles correctly and the result is assigned to a variable used in subsequent computation. Adding const to the declarations suppresses the warning.

Test

$ lintrunner op_softmax.cpp op_log_softmax.cpp op_mean.cpp op_sum.cpp \
             op_softmax_test.cpp op_log_softmax_test.cpp op_mean_test.cpp op_sum_test.cpp
ok  No lint issues.

cc @larryliu0820 @manuelcandales @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani

@pytorch-bot

pytorch-bot Bot commented Jun 18, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20368

Note: Links to docs will display an error until the docs builds have been completed.

❌ 6 New Failures, 1 Cancelled Job, 3 Unrelated Failures, 1 Unclassified Failure

As of commit 39aa25c with merge base 574bfca (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:

CANCELLED JOB - The following job was cancelled. Please retry:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 18, 2026
@github-actions github-actions Bot added ciflow/trunk module: arm Issues related to arm backend labels Jun 18, 2026
@pytorch-bot

pytorch-bot Bot commented Jun 18, 2026 •

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@Gasoonjia

Copy link
Copy Markdown
Contributor

LGTM. Since it touched arm code space more than lint, I will defer to experts @digantdesai @SS-JIA for stamp.

CPPCHECK flagged apply_unary_map_reduce_fn<CTYPE, ACC> with a constStatement
warning. This is a false positive — the code compiles correctly and the result
is assigned to a variable used in subsequent computation. Adding const to the
declarations suppresses the warning.

Signed-off-by: Youngsik Yang <vacu9708@gmail.com>
@vacu9708
vacu9708 force-pushed the fix-log-softmax-cppcheck-const branch from e746737 to 39aa25c Compare June 18, 2026 03:53
@vacu9708

Copy link
Copy Markdown
Contributor Author

@Gasoonjia
Oh I am sorry by mistake I included files I am currently working on for the arm backend in this commit.
I excluded all the ARM-related changes.

@Gasoonjia
Gasoonjia merged commit 9c977bd into pytorch:main Jun 18, 2026
180 of 186 checks passed
@nil-is-all nil-is-all added module: kernels Issues related to kernel libraries and utilities, and code under kernels/ and removed module: arm Issues related to arm backend labels Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: kernels Issues related to kernel libraries and utilities, and code under kernels/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants