https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119715
Bug ID: 119715
Summary: -Wanalyzer-infinite-loop: specify loop invariant in
message where possible
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: dmalcolm at gcc dot gnu.org
Target Milestone: ---
Quoting:
https://www.reddit.com/r/programming/comments/1jvxwpu/comment/mmevj5a/
"EDIT: And that 29-line warning is just saying that n is not modified in the
loop."
Currently the warning message for the case shown there is:
warning: infinite loop [CWE-835] [-Wanalyzer-infinite-loop]
with the extra information shown in the execution path.
For cases like this where there's a simple loop condition that's invariant, it
would be nice to tweak the wording to:
warning: infinite loop: 'n' does not change within the loop [CWE-835]
[-Wanalyzer-infinite-loop]
or similar, to give the user a quicker overview of what the problem is, and not
require them to look at the execution path.