Skip to content

fix(lint): allow defaulted loop counters - #16667

Open
figtracer wants to merge 1 commit into
masterfrom
fig/lint-loop-counters
Open

fix(lint): allow defaulted loop counters#16667
figtracer wants to merge 1 commit into
masterfrom
fig/lint-loop-counters

Conversation

@figtracer

Copy link
Copy Markdown
Member

Recognize the intentional zero start in for (uint256 i; i < n; ++i) instead of reporting its counter as an uninitialized read. The exception is limited to unsigned counters declared in the header, compared against an upper bound, and incremented with ++; declarations outside the header and other uninitialized locals still warn. Loop-body findings and zero-iteration write handling remain unchanged.

Fixes #16641.

Recognize unsigned for-header counters with upper-bound conditions and increment updates, without suppressing other uninitialized reads or changing loop state restoration.
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

✅ Changelog found

The deterministic check will validate the changed entry.

@mattsse mattsse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

fix(lint): uninitialized-local false-positives on a for-loop's own init counter

2 participants