https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115165
Bug ID: 115165 Summary: ICE on -ftime-report with module and c++2b Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: porten at kde dot org Target Milestone: --- Purely by accident, I ran into an ICE when using -ftime-report on a file including a system header with a .gcm file of that header present. The scenario appeared after an attempt to improve compilation speed. timevar.cc line 490 performs gcc_assert (!tv->standalone). Note 1: A combination of #include <x> with x.gcm present may be unsupported. Note 2: The error goes away when compiling with c++2a or c++20 rather than c++2b. $ cat main.cpp #include <iostream> int main(int, char **) { std::cout; } $ g++ -fmodules-ts -std=c++2b -x c++-system-header iostream $ g++ -ftime-report -fmodules-ts -std=c++2b main.cpp main.cpp: In destructor ‘std::__codecvt_abstract_base<_InternT, _ExternT, _StateT>::~__codecvt_abstract_base() [with _InternT = char16_t; _ExternT = char; _StateT = __mbstate_t]’: main.cpp:2:31: internal compiler error: in start, at timevar.cc:490 2 | int main(int, char **) { std::cout; } | ^~~~ 0x74294d timer::start(timevar_id_t) /home/user/git/gcc/gcc/timevar.cc:490 0x74294d timer::start(timevar_id_t) /home/user/git/gcc/gcc/timevar.cc:481 0x74294d timevar_start(timevar_id_t) /home/user/git/gcc/gcc/timevar.cc:475 0x87b7ec lazy_load_pendings(tree_node*) /home/user/git/gcc/gcc/cp/module.cc:19470 0x881c48 maybe_lazily_declare /home/user/git/gcc/gcc/cp/name-lookup.cc:2002 0x881c48 get_class_binding(tree_node*, tree_node*, bool) /home/user/git/gcc/gcc/cp/name-lookup.cc:2038 0x9342fd lookup_field_r /home/user/git/gcc/gcc/cp/search.cc:1061 0x934c18 dfs_walk_all(tree_node*, tree_node* (*)(tree_node*, void*), tree_node* (*)(tree_node*, void*), void*) /home/user/git/gcc/gcc/cp/search.cc:1507 0x934c18 lookup_member(tree_node*, tree_node*, int, bool, int, access_failure_info*) /home/user/git/gcc/gcc/cp/search.cc:1216 0x9350d0 lookup_fnfields(tree_node*, tree_node*, int, int) /home/user/git/gcc/gcc/cp/search.cc:1426 0x773277 build_op_delete_call(tree_code, tree_node*, tree_node*, bool, tree_node*, tree_node*, int) /home/user/git/gcc/gcc/cp/call.cc:7864 0x892372 build_delete_destructor_body /home/user/git/gcc/gcc/cp/optimize.cc:140 0x893738 maybe_clone_body(tree_node*) /home/user/git/gcc/gcc/cp/optimize.cc:610 0x85f01f post_load_processing /home/user/git/gcc/gcc/cp/module.cc:17758 0x877793 lazy_load_binding(unsigned int, tree_node*, tree_node*, binding_slot*) /home/user/git/gcc/gcc/cp/module.cc:19424 0x889b64 name_lookup::search_namespace_only(tree_node*) /home/user/git/gcc/gcc/cp/name-lookup.cc:920 0x889ca4 name_lookup::search_namespace(tree_node*) /home/user/git/gcc/gcc/cp/name-lookup.cc:1006 0x889f8f name_lookup::search_namespace(tree_node*) /home/user/git/gcc/gcc/cp/name-lookup.cc:1001 0x889f8f name_lookup::search_qualified(tree_node*, bool) /home/user/git/gcc/gcc/cp/name-lookup.cc:1067 0x88d161 qualified_namespace_lookup /home/user/git/gcc/gcc/cp/name-lookup.cc:7278 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. GCC was built with today's state of the releases/gcc-14 branch. $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/opt/gcc-14/libexec/gcc/x86_64-pc-linux-gnu/14.1.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /home/porten/git/gcc/configure --disable-multilib --prefix=/opt/gcc-14 --enable-languages=c,c++ : (reconfigured) /home/porten/git/gcc/configure --disable-multilib --prefix=/opt/gcc-14 --enable-languages=c,c++ : (reconfigured) /home/porten/git/gcc/configure --disable-multilib --prefix=/opt/gcc-14 --enable-languages=c,c++,lto --no-create --no-recursion Thread model: posix Supported LTO compression algorithms: zlib gcc version 14.1.1 20240520 (GCC)