https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106820
--- Comment #3 from Mark Millard <markmigm at gmail dot com> --- (In reply to Mark Millard from comment #2) I managed to build lang/gcc12 with -g -O0 in use and so can report: The failing assert looks like: gcc_assert ((!DECL_WEAK (node->decl) && !DECL_COMDAT (node->decl)) || TREE_PUBLIC (node->decl) || node->weakref || DECL_EXTERNAL (node->decl)); 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>>