https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120125
Nathaniel Shead <nshead at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2025-05-06
Status|UNCONFIRMED |NEW
CC| |nshead at gcc dot gnu.org
Ever confirmed|0 |1
Keywords|needs-reduction |ice-on-valid-code
Summary|ICE when using -Os and std |[15/16 Regression] ICE in
|module together |add_to_same_comdat_group
| |when using -Os or
| |-fdeclone-ctor-dtor
--- Comment #1 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Reduced:
// vector.cpp
export module vector;
export extern "C++" {
template <typename _Tp> struct __shared_ptr {
__shared_ptr() {}
};
template class __shared_ptr<int>;
template <typename _Tp>
struct vector {
friend __shared_ptr<int>;
};
}
// main.cpp
import vector;
vector<int> vec;
$ g++ -fmodules -S -fdeclone-ctor-dtor vector.cpp main.cpp
main.cpp:2:1: internal compiler error: Segmentation fault
2 | vector<int> vec;
| ^~~~~~
0x3d40fdf internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:517
0x1d6f7a8 crash_signal
../../gcc/gcc/toplev.cc:321
0x7f52dc05b32f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x15ca46f symtab_node::add_to_same_comdat_group(symtab_node*)
../../gcc/gcc/symtab.cc:492
0x11d3505 maybe_thunk_body
../../gcc/gcc/cp/optimize.cc:314
0x11d5580 maybe_clone_body(tree_node*)
../../gcc/gcc/cp/optimize.cc:561
0x135039f expand_or_defer_fn_1(tree_node*)
../../gcc/gcc/cp/semantics.cc:5508
0x13506e4 expand_or_defer_fn(tree_node*)
../../gcc/gcc/cp/semantics.cc:5543
0x11855fc post_load_processing
../../gcc/gcc/cp/module.cc:19241
0x118bb92 lazy_load_binding(unsigned int, tree_node*, tree_node*,
binding_slot*)
../../gcc/gcc/cp/module.cc:21122
0x11a8459 name_lookup::search_namespace_only(tree_node*)
../../gcc/gcc/cp/name-lookup.cc:929
0x11a9226 name_lookup::search_unqualified(tree_node*, cp_binding_level*)
../../gcc/gcc/cp/name-lookup.cc:1159
0x11c5d9c lookup_name(tree_node*, LOOK_where, LOOK_want)
../../gcc/gcc/cp/name-lookup.cc:8128
0xf3d11d lookup_name(tree_node*, LOOK_want)
../../gcc/gcc/cp/name-lookup.h:410
0x12207c5 cp_parser_lookup_name
../../gcc/gcc/cp/parser.cc:33039
0x12027ff cp_parser_template_name
../../gcc/gcc/cp/parser.cc:19930
0x1201ad4 cp_parser_template_id
../../gcc/gcc/cp/parser.cc:19537
0x1213477 cp_parser_class_name
../../gcc/gcc/cp/parser.cc:27434
0x11e4803 cp_parser_qualifying_entity
../../gcc/gcc/cp/parser.cc:7704
0x11e3bac cp_parser_nested_name_specifier_opt
../../gcc/gcc/cp/parser.cc:7390
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.
This reduced sample fails on 15 and trunk, but worked in 14. It looks like it
might be helpful to add some "torture"-style tests with optimisation flags etc.
for the modules testsuite so that we catch these issues sooner.