https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117540
Bug ID: 117540
Summary: ICE on x86_64-linux-gnu: verify_cgraph_node failed at
-Os.
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: iamanonymous.cs at gmail dot com
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/hvnrGEnnK
*******************************************************************************
gcc version:
Using built-in specs.
COLLECT_GCC=/home/software/gcc-trunk/bin/gcc
COLLECT_LTO_WRAPPER=/home/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --disable-bootstrap --enable-checking=yes
--prefix=/home/software/gcc-trunk --enable-sanitizers --enable-languages=c,c++
--disable-werror --enable-multilib --enable-coverage
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20241107 (experimental) (GCC)
*******************************************************************************
Program:
$ cat mutant.C
enum _Ios_Openmode {};
struct ios_base {};
struct basic_istream : virtual ios_base {};
struct basic_ifstream : basic_istream {
basic_ifstream(char *, _Ios_Openmode);
_Ios_Openmode basic_ifstream___mode;
template <typename _Path>
basic_ifstream(_Path &__s)
: basic_ifstream(__s.c_str(), basic_ifstream___mode) {}
};
struct Trans_NS___cxx11_path {
using value_type = char;
value_type *c_str();
};
struct Trans_NS___cxx11_directory_entry {
Trans_NS___cxx11_path &path();
};
struct Trans_NS___cxx11_recursive_directory_iterator {
Trans_NS___cxx11_directory_entry *operator->();
};
int __attribute__((flatten)) main() {
Trans_NS___cxx11_recursive_directory_iterator it;
basic_ifstream(it->path());
}
*******************************************************************************
Command Lines:
$ gcc -Os mutant.C
mutant.C:24:1: error: calls_comdat_local is set outside of a comdat group
24 | }
| ^
mutant.C:24:1: error: invalid calls_comdat_local flag
main/0 (int main())
Type: function definition analyzed
Visibility: externally_visible semantic_interposition public
References:
Referring:
Availability: available
Function flags: count:1073741824 (estimated locally) body
only_called_at_startup calls_comdat_local executed_once optimize_size
Called by:
Calls: _ZN14basic_ifstreamC1I21Trans_NS___cxx11_pathEERT_/3 (inlined)
(1073741824 (estimated locally),1.00 per call) (can throw external)
_ZN32Trans_NS___cxx11_directory_entry4pathEv/12 (1073741824 (estimated
locally),1.00 per call) (can throw external)
_ZN45Trans_NS___cxx11_recursive_directory_iteratorptEv/11 (1073741824
(estimated locally),1.00 per call) (can throw external)
during IPA pass: inline
mutant.C:24:1: internal compiler error: verify_cgraph_node failed
0x5cdf4f4 internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:518
0x19e824c cgraph_node::verify_node()
../../gcc/gcc/cgraph.cc:3960
0x19ba49e symtab_node::verify()
../../gcc/gcc/symtab.cc:1363
0x19babb4 symtab_node::verify_symtab_nodes()
../../gcc/gcc/symtab.cc:1483
0x1a04e00 symtab_node::checking_verify_symtab_nodes()
../../gcc/gcc/cgraph.h:689
0x210d189 symbol_table::remove_unreachable_nodes(_IO_FILE*)
../../gcc/gcc/ipa.cc:680
0x582f086 ipa_inline
../../gcc/gcc/ipa-inline.cc:2886
0x5830be6 execute
../../gcc/gcc/ipa-inline.cc:3277
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.
If I remove the flatten attribute from main, the compiler does not crash.