https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105418
Bug ID: 105418 Summary: debug_tree does not support well for std::construct_at Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: guojiufu at gcc dot gnu.org Target Milestone: --- During debug GCC, when call "debug_tree" inside gdb, I found "debug_tree" fail on "std::construct_at". It fails from "decl_as_string" To reproduce this issue quicker, the below patch could be used. ----------- diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index cebf9c35c1d..ead4112dd37 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -4793,10 +4793,12 @@ trees_out::get_tag (tree t) } /* Insert T into the map, return its tag number. */ - +const char* decl_as_string(tree, int);//void debug_tree(tree); int trees_out::insert (tree t, walk_kind walk) { + if (TREE_CODE (t) == FUNCTION_DECL) + decl_as_string (t,TFF_DECL_SPECIFIERS);//debug_tree (t); gcc_checking_assert (walk != WK_normal || !TREE_VISITED (t)); int tag = --ref_num; bool existed; ---------- configure the GCC with below command: $ configure --enable-languages=c,c++ --with-cpu=native --enable-checking --with-long-double-128 --prefix=/home/guojiufu/gcc/install/gcc-mainline-base-debug --disable-bootstrap Using test case: t.cc ----------- #include <memory> struct S { int x; float y; double z; S(int x, float y, double z) : x{x}, y{y}, z{z} { } }; void foo() { alignas(S) unsigned char storage[sizeof(S)]; S* ptr = std::construct_at(reinterpret_cast<S*>(storage), 42, 2.71828f, 3.1415); std::destroy_at(ptr); } ------------ $ g++ -fmodule-header t.cc -std=gnu++20 In file included from /home/guojiufu/gcc/build/gcc-mainline-base-debug/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/stl_iterator.h:85, from /home/guojiufu/gcc/build/gcc-mainline-base-debug/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:67, from /home/guojiufu/gcc/build/gcc-mainline-base-debug/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/memory:63, from t.cc:1: /home/guojiufu/gcc/build/gcc-mainline-base-debug/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/stl_construct.h:96:17: internal compiler error: in perform_overload_resolution, at cp/call.cc:4710 96 | -> decltype(::new((void*)0) _Tp(std::declval<_Args>()...)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0x106b32cb perform_overload_resolution /home/guojiufu/gcc/gcc-mainline-base/gcc/cp/call.cc:4710 0x106b3d9f build_operator_new_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node**, tree_node**, tree_node*, tree_node*, tree_node**, int) /home/guojiufu/gcc/gcc-mainline-base/gcc/cp/call.cc:4929 0x108d0743 build_new_1 /home/guojiufu/gcc/gcc-mainline-base/gcc/cp/init.cc:3412 0x108d300f build_new(unsigned int, vec<tree_node*, va_gc, vl_embed>**, tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int, int) /home/guojiufu/gcc/gcc-mainline-base/gcc/cp/init.cc:4014 0x10b210ef tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/guojiufu/gcc/gcc-mainline-base/gcc/cp/pt.cc:20557 0x10b01ddf tsubst(tree_node*, tree_node*, int, tree_node*) /home/guojiufu/gcc/gcc-mainline-base/gcc/cp/pt.cc:16306 0x10896f6b dump_template_bindings /home/guojiufu/gcc/gcc-mainline-base/gcc/cp/error.cc:486 0x1089f887 dump_substitution /home/guojiufu/gcc/gcc-mainline-base/gcc/cp/error.cc:1654