https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106230
Bug ID: 106230 Summary: ICE when building folly-2022.07.04.00 in pop_local_binding (cp/name-lookup.cc:2474) Product: gcc Version: 12.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sam at gentoo dot org Target Milestone: --- Created attachment 53274 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53274&action=edit ccHXKhJc.ii.orig (original preprocessed source) Hit this when building folly-2022.07.04.00 with 12.1.1_p20220702. I've attached the original reproducer but I'll attach a minimised version shortly too. ``` [484/826] /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFMT_SHARED -DFOLLY_XLOG_STRIP_PREFIXES=\"/var/tmp/portage/dev-cpp/folly-2022.07.04.00/work:/var/tmp/portage/dev-cpp/folly-2022.07.04.00/work_build\" -DGFLAGS_IS_A_DLL=0 -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -D_GNU_SOURCE -D_REENTRANT -I/var/tmp/portage/dev-cpp/folly-2022.07.04.00/work -I/var/tmp/portage/dev-cpp/folly-2022.07.04.00/work_build -I/usr/include/libiberty -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -D_GLIBCXX_ASSERTIONS -ggdb3 -Werror=format-security -Wformat -g -std=gnu++1z -finput-charset=UTF-8 -fsigned-char -Wall -Wno-deprecated -Wno-deprecated-declarations -Wno-sign-compare -Wno-unused -Wuninitialized -Wunused-label -Wunused-result -Wno-noexcept-type -Wno-nullability-completeness -Wno-inconsistent-missing-override -faligned-new -fopenmp -std=gnu++17 -MD -MT CMakeFiles/atomic_util_test.dir/folly/synchronization/test/AtomicUtilTest.cpp.o -MF CMakeFiles/atomic_util_test.dir/folly/synchronization/test/AtomicUtilTest.cpp.o.d -o CMakeFiles/atomic_util_test.dir/folly/synchronization/test/AtomicUtilTest.cpp.o -c /var/tmp/portage/dev-cpp/folly-2022.07.04.00/work/folly/synchronization/test/AtomicUtilTest.cpp FAILED: CMakeFiles/atomic_util_test.dir/folly/synchronization/test/AtomicUtilTest.cpp.o /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFMT_SHARED -DFOLLY_XLOG_STRIP_PREFIXES=\"/var/tmp/portage/dev-cpp/folly-2022.07.04.00/work:/var/tmp/portage/dev-cpp/folly-2022.07.04.00/work_build\" -DGFLAGS_IS_A_DLL=0 -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -D_GNU_SOURCE -D_REENTRANT -I/var/tmp/portage/dev-cpp/folly-2022.07.04.00/work -I/var/tmp/portage/dev-cpp/folly-2022.07.04.00/work_build -I/usr/include/libiberty -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -D_GLIBCXX_ASSERTIONS -ggdb3 -Werror=format-security -Wformat -g -std=gnu++1z -finput-charset=UTF-8 -fsigned-char -Wall -Wno-deprecated -Wno-deprecated-declarations -Wno-sign-compare -Wno-unused -Wuninitialized -Wunused-label -Wunused-result -Wno-noexcept-type -Wno-nullability-completeness -Wno-inconsistent-missing-override -faligned-new -fopenmp -std=gnu++17 -MD -MT CMakeFiles/atomic_util_test.dir/folly/synchronization/test/AtomicUtilTest.cpp.o -MF CMakeFiles/atomic_util_test.dir/folly/synchronization/test/AtomicUtilTest.cpp.o.d -o CMakeFiles/atomic_util_test.dir/folly/synchronization/test/AtomicUtilTest.cpp.o -c /var/tmp/portage/dev-cpp/folly-2022.07.04.00/work/folly/synchronization/test/AtomicUtilTest.cpp /var/tmp/portage/dev-cpp/folly-2022.07.04.00/work/folly/synchronization/test/AtomicUtilTest.cpp: In instantiation of ‘void folly::{anonymous}::atomic_fetch_flip_basic(Op) [with TypeParam = atomic_ref_of<std::atomic>; Integer = short unsigned int; Op = with_order<folly::atomic_fetch_flip_fn>]’: /var/tmp/portage/dev-cpp/folly-2022.07.04.00/work/folly/synchronization/test/AtomicUtilTest.cpp:385:52: required from ‘void folly::gtest_suite_AtomicFetchFlipTest_::Basic<gtest_TypeParam_>::TestBody() [with gtest_TypeParam_ = folly::{anonymous}::atomic_ref_of<std::atomic>]’ /var/tmp/portage/dev-cpp/folly-2022.07.04.00/work/folly/synchronization/test/AtomicUtilTest.cpp:382:1: required from here /var/tmp/portage/dev-cpp/folly-2022.07.04.00/work/folly/synchronization/test/AtomicUtilTest.cpp:241:3: internal compiler error: in pop_local_binding, at cp/name-lookup.cc:2474 241 | for (ref_ atomic : std::array<obj_, Size>{}) { | ^~~ 0x72069f pop_local_binding(tree_node*, tree_node*) /usr/src/debug/sys-devel/gcc-12.1.1_p20220702/gcc-12-20220702/gcc/cp/name-lookup.cc:2474 0x72069f poplevel(int, int, int) /usr/src/debug/sys-devel/gcc-12.1.1_p20220702/gcc-12-20220702/gcc/cp/decl.cc:733 0x13a626c do_poplevel(tree_node*) /usr/src/debug/sys-devel/gcc-12.1.1_p20220702/gcc-12-20220702/gcc/cp/semantics.cc:640 0x14f98c5 finish_for_stmt(tree_node*) /usr/src/debug/sys-devel/gcc-12.1.1_p20220702/gcc-12-20220702/gcc/cp/semantics.cc:1399 0x15c481e tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /usr/src/debug/sys-devel/gcc-12.1.1_p20220702/gcc-12-20220702/gcc/cp/pt.cc:18768 0x15c42ff tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /usr/src/debug/sys-devel/gcc-12.1.1_p20220702/gcc-12-20220702/gcc/cp/pt.cc:18507 0x15c41f4 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /usr/src/debug/sys-devel/gcc-12.1.1_p20220702/gcc-12-20220702/gcc/cp/pt.cc:18864 0x163cc24 instantiate_body /usr/src/debug/sys-devel/gcc-12.1.1_p20220702/gcc-12-20220702/gcc/cp/pt.cc:26466 0x163ab56 instantiate_decl(tree_node*, bool, bool) /usr/src/debug/sys-devel/gcc-12.1.1_p20220702/gcc-12-20220702/gcc/cp/pt.cc:26758 0x1309d40 instantiate_pending_templates(int) /usr/src/debug/sys-devel/gcc-12.1.1_p20220702/gcc-12-20220702/gcc/cp/pt.cc:26837 0x1302380 c_parse_final_cleanups() /usr/src/debug/sys-devel/gcc-12.1.1_p20220702/gcc-12-20220702/gcc/cp/decl2.cc:5128 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://bugs.gentoo.org/> for instructions. ``` ``` $ gcc --version gcc (Gentoo Hardened 12.1.1_p20220702 p8) 12.1.1 20220702 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ```