https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122019
Nathaniel Shead <nshead at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |nshead at gcc dot
gnu.org
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
CC| |nshead at gcc dot gnu.org
Last reconfirmed| |2025-09-22
--- Comment #1 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Confirmed. Reduced:
// a.cpp
module;
typedef int pthread_once_t;
export module A;
namespace ns {
export using ::pthread_once_t;
}
// b.cpp
import M;
extern "C" ns::pthread_once_t x;
$ g++ -fmodules -Wno-global-module -S a.cpp b.cpp
bb.C:5:16: internal compiler error: Segmentation fault
5 | extern "C" ns::pthread_once_t x;
| ^~~~~~~~~~~~~~
0x3e013e0 internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:786
0x1e6e990 crash_signal
../../gcc/gcc/toplev.cc:323
0x7adc93045f9f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0xf5c70d tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
../../gcc/gcc/tree.h:3887
0x142f9e8 decl_linkage(tree_node*)
../../gcc/gcc/cp/tree.cc:6403
0x116efc6 set_decl_linkage
../../gcc/gcc/cp/lex.cc:1025
0x116f242 retrofit_lang_decl(tree_node*)
../../gcc/gcc/cp/lex.cc:1071
0x11c76f5 install_entity
../../gcc/gcc/cp/module.cc:8153
0x11ca70f decl_value
../../gcc/gcc/cp/module.cc:8743
0x11d2946 tree_node
../../gcc/gcc/cp/module.cc:10265
0x11f4a13 module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:17007
0x1200d7a module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:20813
0x1203eaa module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:21665
0x11d5692 tree_node
../../gcc/gcc/cp/module.cc:10845
0x11f3e21 module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:16862
0x1200d7a module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:20813
0x1204018 lazy_load_binding(unsigned int, tree_node*, tree_node*,
binding_slot*)
../../gcc/gcc/cp/module.cc:21702
0x1220c30 name_lookup::search_namespace_only(tree_node*)
../../gcc/gcc/cp/name-lookup.cc:929
0x12211fa name_lookup::search_namespace(tree_node*)
../../gcc/gcc/cp/name-lookup.cc:1022
0x1221512 name_lookup::search_qualified(tree_node*, bool)
../../gcc/gcc/cp/name-lookup.cc:1083
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.
It looks like in general our handling of language linkage is insufficient; I
have a patch.