Landing: dee30fc0e980
Project / Subsystem
gcc / gcc
Date
2026-05-12
Author
Martin Uecker
Commit
dee30fc0e980ee26a804a74da74decc0cea10b8f
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- gcc
- patch_id
- —
- commit_hash
- dee30fc0e980ee26a804a74da74decc0cea10b8f
- source_type
- github
- headline
- c: Avoid false positive for useless casts and generic [PR125261]
- tldr
- The compiler now avoids issuing false warnings for useless casts in C code, particularly with generic selections.
- author
- Martin Uecker
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • c
- • warning
- • cast
- • generic selection
- • bugfix
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-05-12T00:00:00.000Z
This commit reduces false positive warnings for -Wuseless-cast in C code, specifically related to generic selections. The fix guards the -Wuseless-cast warning with c_inhibit_evaluation_warnings. It increments this counter during generic association when a prior match (other than the default) has been seen, improving accuracy in detecting genuinely useless casts. New test case gcc.dg/pr125261.c validates the fix.