public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gabravier at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/114408] New: Crash when invoking strcmp multiple times with -fsanitize=undefined -O1 -fanalyzer -flto
Date: Wed, 20 Mar 2024 15:26:10 +0000	[thread overview]
Message-ID: <bug-114408-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 114408
           Summary: Crash when invoking strcmp multiple times with
                    -fsanitize=undefined -O1 -fanalyzer -flto
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

int main(){}

int HMAP_unset_copy(const char *key) {
    return __builtin_strcmp("a", key) + __builtin_strcmp("a", key);
}

Compiling this program with `-fsanitize=undefined -O1 -fanalyzer -flto` results
in the following:

<source>: In function 'HMAP_unset_copy':
<source>:4:41: warning: check of 'key_4(D)' for NULL after already
dereferencing it [-Wanalyzer-deref-before-check]
    4 |     return __builtin_strcmp("a", key) + __builtin_strcmp("a", key);
      |                                         ^
  'HMAP_unset_copy': events 1-2
    |
    |    4 |     return __builtin_strcmp("a", key) + __builtin_strcmp("a",
key);
    |      |            ^                            ~
    |      |            |                            |
    |      |            |                            (2) pointer 'key_4(D)' is
checked for NULL here but it was already dereferenced at (1)
    |      |            (1) pointer 'key_4(D)' is dereferenced here
    |
during IPA pass: whole-program
At top level:
lto1: internal compiler error: in release_function_body, at cgraph.cc:1813
0x221519c internal_error(char const*, ...)
        ???:0
0x926a67 fancy_abort(char const*, int, char const*)
        ???:0
0xa1a687 cgraph_node::release_body(bool)
        ???:0
0xa1c2d2 cgraph_node::remove()
        ???:0
0xcea661 symbol_table::remove_unreachable_nodes(_IO_FILE*)
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: /opt/compiler-explorer/gcc-snapshot/bin/gcc returned
1 exit status
compilation terminated.
/opt/compiler-explorer/gcc-trunk-20240320/bin/../lib/gcc/x86_64-linux-gnu/14.0.1/../../../../x86_64-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
Compiler returned: 1

             reply	other threads:[~2024-03-20 15:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 15:26 gabravier at gmail dot com [this message]
2024-03-21  9:35 ` [Bug analyzer/114408] [13/14 Regression] ICE " rguenth at gcc dot gnu.org
2024-03-22 12:35 ` 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@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).