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