https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106820
--- Comment #4 from Mark Millard <markmigm at gmail dot com> --- (In reply to Mark Millard from comment #3) > . . . > And in a debugger I see: > > (lldb) print node->decl->decl_with_vis.weak_flag > (unsigned int) $2 = 1 > (lldb) print node->decl->decl_with_vis.comdat_flag > (unsigned int) $3 = 0 > (lldb) print node->weakref > (unsigned int) $4 = 0 > (lldb) print node->decl->decl_common.decl_flag_1 > (unsigned int) $5 = 0 > > and: > > (lldb) call debug_tree(node->decl) > <function_decl 0x9986ca00 __gthrw_pthread_mutex_unlock > type <function_type 0x939e7e70 > type <integer_type 0x8cd415e8 int sizes-gimplified public type_6 SI > size <integer_cst 0x8cd40258 constant 32> > unit-size <integer_cst 0x8cd40270 constant 4> > align:32 warn_if_not_align:0 symtab:0 alias-set -1 > canonical-type 0x8cd415e8 precision:32 min <integer_cst 0x8cd40210 > -2147483648> max <integer_cst 0x8cd40228 2147483647> > pointer_to_this <pointer_type 0x8cd48a80> reference_to_this > <reference_type 0x9bb63000>> > SI size <integer_cst 0x8cd40258 32> unit-size <integer_cst > 0x8cd40270 4> > align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type > 0x939e7f18 > arg-types <tree_list 0x9986d168 value <pointer_type 0x939e7a80> > chain <tree_list 0x8cd2b938 value <void_type 0x8cd41f18 void>>> > pointer_to_this <pointer_type 0x99870150>> > addressable used static tree_3 weak in_system_header decl_5 decl_6 DI > /usr/local/lib/gcc12/include/c++/aarch64-portbld-freebsd14.0/bits/gthr- > default.h:121:1 align:32 warn_if_not_align:0 context <translation_unit_decl > 0x8cd3e000 module_shared_ptr_alias_construction_failure.cpp> > attributes <tree_list 0x9986d230 > purpose <identifier_node 0x939ca980 alias > normal local bindings <0x0>> > value <tree_list 0x9986d258 > value <string_cst 0x939c6d80 type <array_type 0x939e77e0> > readonly constant static "pthread_mutex_unlock\000">> > chain <tree_list 0x9986d280 > purpose <identifier_node 0x939ca9c0 weakref > normal local bindings <0x0>>>> > full-name "int __gthrw_pthread_mutex_unlock(pthread_mutex**)" > module 1:/usr/local/lib/gcc12/include/c++/memory exported chain > <function_decl 0x9986c900 __gthread_trigger>> And, sure enough, __gthrw_pthread_mutex_unlock looks to involve "weak" via https://github.com/gcc-mirror/gcc/blob/master/libgcc/gthr-posix.h having in use: # define __gthrw2(name,name2,type) \ static __typeof(type) name \ __attribute__ ((__weakref__(#name2), __copy__ (type))); \ __gthrw_pragma(weak type) . . . /* Typically, __gthrw_foo is a weak reference to symbol foo. */ #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) . . . __gthrw(pthread_mutex_unlock) There could be more examples of the type of issue but the build stops at the first to fail the gcc_assert.