public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug analyzer/114408] [13/14 Regression] ICE when invoking strcmp multiple times with -fsanitize=undefined -O1 -fanalyzer -flto
Date: Thu, 21 Mar 2024 09:35:32 +0000	[thread overview]
Message-ID: <bug-114408-4-xibaKZu9DQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114408-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114408

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.3.0
   Target Milestone|---                         |13.3
           Assignee|unassigned at gcc dot gnu.org      |dmalcolm at gcc dot gnu.org
            Summary|ICE when invoking strcmp    |[13/14 Regression] ICE when
                   |multiple times with         |invoking strcmp multiple
                   |-fsanitize=undefined -O1    |times with
                   |-fanalyzer -flto            |-fsanitize=undefined -O1
                   |                            |-fanalyzer -flto
                 CC|                            |dmalcolm at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |13.2.1
          Component|ipa                         |analyzer
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-03-21

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed also with GCC 13, works with GCC 12.

The diagnostic is because of UBSAN instrumentation, it's already visible
without -flto.

The issue with the ICE is likely that the sanitizer computes dominance info at
IPA time but fails to release it?

I see in sm-malloc.cc:

    /* Reject the warning if the deref's BB doesn't dominate that
       of the check, so that we don't warn e.g. for shared cleanup
       code that checks a pointer for NULL, when that code is sometimes
       used before a deref and sometimes after.
       Using the dominance code requires setting cfun.  */
    auto_cfun sentinel (m_deref_enode->get_function ());
    calculate_dominance_info (CDI_DOMINATORS);
    if (!dominated_by_p (CDI_DOMINATORS,
                         m_check_enode->get_supernode ()->m_bb,
                         m_deref_enode->get_supernode ()->m_bb))
      return false;

    return ctxt.warn ("check of %qE for NULL after already"
                      " dereferencing it",
                      m_arg);

but no free_dominance_info anywhere.  It would of course be quite expensive
to re-compute all dominance info every time here, so analyzer needs to
loop over all functions releasing dominance info when done.

  reply	other threads:[~2024-03-21  9:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 15:26 [Bug ipa/114408] New: Crash " gabravier at gmail dot com
2024-03-21  9:35 ` rguenth at gcc dot gnu.org [this message]
2024-03-22 12:35 ` [Bug analyzer/114408] [13/14 Regression] ICE " law at gcc dot gnu.org
2024-03-22 15:09 ` dmalcolm at gcc dot gnu.org
2024-03-22 16:52 ` jakub at gcc dot gnu.org
2024-03-22 16:56 ` jakub at gcc dot gnu.org
2024-03-22 18:34 ` dmalcolm at gcc dot gnu.org
2024-03-23 13:53 ` cvs-commit at gcc dot gnu.org
2024-03-23 14:00 ` [Bug analyzer/114408] [13 " dmalcolm at gcc dot gnu.org
2024-05-09 17:12 ` cvs-commit at gcc dot gnu.org
2024-05-09 17:49 ` [Bug analyzer/114408] " dmalcolm 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-114408-4-xibaKZu9DQ@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).