Skip to content

Fix always-true comparison warning in H5Znbit.c - #6773

Open
hyoklee wants to merge 4 commits into
HDFGroup:developfrom
hyoklee:fix-nbit-type-limits
Open

hyoklee wants to merge 4 commits into
HDFGroup:developfrom
hyoklee:fix-nbit-type-limits

Conversation

@hyoklee

@hyoklee hyoklee commented Oct 22, 2026

Copy link
Copy Markdown
Member

Fixes #6772

The two parameter-length checks in H5Z__nbit_decompress() start at index 0, where H5Z_NBIT_PARMS_AVAIL(0, n, parms_nelmts) reduces to parms_nelmts >= n plus an always-true unsigned comparison, which GCC reports with -Wtype-limits. These two checks now compare parms_nelmts directly. Behavior is unchanged.

Tested: the library builds without the warning with GCC on Linux, and the dsets tests (which cover the nbit filter) pass.

🤖 Generated with Claude Code

The two parameter-length checks in H5Z__nbit_decompress() start at index 0,
where H5Z_NBIT_PARMS_AVAIL reduces to parms_nelmts >= n plus an
always-true unsigned compare (-Wtype-limits). Compare directly instead.

Fixes HDFGroup#6772

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Checklist

This PR touches the following areas. Each needs a sign-off
from its listed owners before merging.

Additional reviewers (not owners of a touched area): @bmribler

@ajelenak
ajelenak requested review from bmribler and removed request for mattjala October 23, 2026 16:10

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

Status: To be triaged

Development

Successfully merging this pull request may close these issues.

Always-true comparison warning (-Wtype-limits) in H5Znbit.c

1 participant