public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "andrew at ishiboo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug analyzer/100524] New: pragma GCC diagnostic ignored "-Wanalyzer-too-complex" ignored by cc1
Date: Tue, 11 May 2021 14:46:31 +0000	[thread overview]
Message-ID: <bug-100524-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2021-05-11 14:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 14:46 andrew at ishiboo dot com [this message]
2021-11-30 19:23 ` [Bug analyzer/100524] " dmalcolm at gcc dot gnu.org
2021-11-30 22:50 ` cvs-commit at gcc dot gnu.org
2021-11-30 23:04 ` dmalcolm at gcc dot gnu.org
2021-12-01  0:29 ` egallager at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100524-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).