https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100524
David Malcolm <dmalcolm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2021-11-30 Ever confirmed|0 |1 --- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Thanks for filing this bug. Firstly, what you wrote in comment #0 has the directive transposed as: #pragma diagnostic GCC [...action...] whereas the directive should be: #pragma GCC diagnostic [...action...] I've tested the latter with a simple reproducer and verified that I can disable -Wanalyzer-too-complex with it, whereas the transposed version of the directive is ignored by GCC and thus does nothing; I'm working on a regression test for this. Secondly, there's an issue with source locations in the diagnostic you quoted: the prefix: "cc1: error: " doesn't contain a source location. Internally this comes from diagnostic_build_prefix when the diagnostic's location has a NULL filename, which is most likely due to a statement with an UNKNOWN_LOCATION. So the issue is due to a statement in GCC's gimple-ssa IR having UNKNOWN_LOCATION for its location, which thus doesn't show up within the range of source locations expressed by the pragma, and thus the diagnostic isn't affected by the pragmas. The fix would be to fix the location of the statement in the gimple-ssa IR, but without a reproducer to identify where that statement's coming from (e.g. in one of the passes that runs before the analyzer), that's hard to do. Do you still have the code that reproduces this issue? (and the precise optimization flags)