Landing: 5b0937f037e3
Project / Subsystem
gcc / analyzer
Date
2026-02-24
Author
David Malcolm
Commit
5b0937f037e3b341cd906db07cedf016ba78dd3b
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- analyzer
- patch_id
- —
- commit_hash
- 5b0937f037e3b341cd906db07cedf016ba78dd3b
- source_type
- github
- headline
- Analyzer: Introduce `-Wanalyzer-div-by-zero` warning
- tldr
- The GCC analyzer now issues a `-Wanalyzer-div-by-zero` warning for potential division-by-zero errors.
- author
- David Malcolm
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • analyzer
- • static analysis
- • division by zero
- • warning
- • diagnostic
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-02-24T00:00:00.000Z
The GCC static analyzer now includes a -Wanalyzer-div-by-zero warning, which detects potential division-by-zero errors during compilation. The analyzer identifies division operations where the divisor could be zero, issuing a warning to alert developers. This new diagnostic capability helps catch potential runtime errors early, improving code reliability and preventing unexpected program termination. The implementation includes modifications to the analyzer’s region model and adds new test cases to verify the warning’s effectiveness.