https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110285
Bug ID: 110285
Summary: -Wanalyzer-infinite-loop false positive.
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: 080ariel at gmail dot com
Target Milestone: ---
Created attachment 55346
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55346&action=edit
Preprocessed file of a-test1.i
-Wanalyzer-infinite-loop reports a false positive in test1.c with -O0 -O1 -O2
but not with -O3.
-Wanalyzer-infinite-loop reports a false positive in test2.c only with -O3.
Small changes fix the bug or change it from happening only
in -O3 to happening only in the others levels and vice-versa.
It is why I have not been able to make test2.c minimal while
keeping the bug in -O3(it is attached just to show it can
also happen in -O3).
It does not realize it cannot recurse because the condition
to recurse is both condition_to_recurse and !condition_to_recurse.
The analyzer report exactly the same thing in 14.0.0 and in 13.1.1.
----------------------------------------------------------------------
Tested both in 13.1.1 and in 14.0.0(commit:
b6cb10af12cf869c1ae348c0e5cb2d364ef0abce) in Linux.
Options given when GCC was configured/built: ../configure --enable-languages=c
Complete command line that triggers the bug: gcc -fanalyzer minimalcase.c