https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100524
Bug ID: 100524
Summary: pragma GCC diagnostic ignored "-Wanalyzer-too-complex"
ignored by cc1
Product: gcc
Version: 11.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: andrew at ishiboo dot com
Target Milestone: ---
Invoking the compiler from the command line as:
gcc -fanalyzer -Wanalyzer-too-complex -Werror=analyzer-too-complex ...
Source code contains a function that generates a -Wanalyzer-too-complex error
(exact error unimportant):
...
cc1: error: terminating analysis for this program point: callstring: [(SN: 17
-> SN: 9 in X), (SN: 141 -> SN: 16 in X)] before (SN: 115 stmt: 0): # DEBUG
emptySlots$1 => emptySlots$1_80EN: 973-975, EN: 1017-1018, EN: 1054-1056
[-Werror=analyzer-too-complex]
test.c: At top level:
test.c:516:22: error analysis bailed out early (916 'after-snode' enodes;
3258 enodes) [-Werror=analyzer-too-complex]
516 | ...
|
cc1: all warnings being treated as errors
Placing pragma diagnostic guards around the function in question silences the
compiler front-end error, but cc1 still produces the same errors and fails with
-Werror=analyzer-too-complex:
#pragma diagnostic GCC push
#pragma diagnostic GCC ignored "-Wanalyzer-too-complex"
// function definition that generates the error
#pragma diagnostic GCC pop
Output:
...
cc1: error: terminating analysis for this program point: callstring: [(SN: 17
-> SN: 9 in X), (SN: 141 -> SN: 16 in X)] before (SN: 115 stmt: 0): # DEBUG
emptySlots$1 => emptySlots$1_80EN: 973-975, EN: 1017-1018, EN: 1054-1056
[-Werror=analyzer-too-complex]
cc1: all warnings being treated as errors
The "test.c" output with the compiler error and source code context are no
longer output, but cc1 still produces a fatal error and halts compilation.
I would expect that if the warning is `#pragma diagnostic GCC ignored` that cc1
would respect this, otherwise it is not possible to fine-grain ignore specific
complex portions of code in this manner.