public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/114408] New: Crash when invoking strcmp multiple times with -fsanitize=undefined -O1 -fanalyzer -flto
@ 2024-03-20 15:26 gabravier at gmail dot com
  2024-03-21  9:35 ` [Bug analyzer/114408] [13/14 Regression] ICE " rguenth at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gabravier at gmail dot com @ 2024-03-20 15:26 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-05-09 17:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-20 15:26 [Bug ipa/114408] New: Crash when invoking strcmp multiple times with -fsanitize=undefined -O1 -fanalyzer -flto gabravier at gmail dot com
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

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).