| ~~~~^ ../include/llvm/ADT/SparseBitVector.h:54:11: note: while referencing 'llvm::SparseBitVectorElement<128>::Bits' 54 | BitWord Bits[BITWORDS_PER_ELEMENT]; | ^~~~ [1031/4271] Building CXX object lib/DebugInfo/PDB/CMakeFiles/LLVMDebugInfoPDB.dir/Native/PDBFileBuilder.cpp.o In file included from ../include/llvm/DebugInfo/PDB/Native/HashTable.h:12, from ../include/llvm/DebugInfo/PDB/Native/NamedStreamMap.h:16, from ../include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h:15, from ../lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp:9: ../include/llvm/ADT/SparseBitVector.h: In member function 'void llvm::pdb::PDBFileBuilder::commitSrcHeaderBlock(llvm::WritableBinaryStream&, const llvm::msf::MSFLayout&)': ../include/llvm/ADT/SparseBitVector.h:129:15: warning: array subscript 2 is above array bounds of 'const BitWord [2]' {aka 'const long unsigned int [2]'} [-Warray-bounds] 129 | if (Bits[i] != 0) | ~~~~^ ../include/llvm/ADT/SparseBitVector.h:54:11: note: while referencing 'llvm::SparseBitVectorElement<128>::Bits' 54 | BitWord Bits[BITWORDS_PER_ELEMENT]; | ^~~~ ../include/llvm/ADT/SparseBitVector.h: In member function 'void llvm::pdb::HashTable<ValueT>::grow(TraitsT&) [with TraitsT = llvm::pdb::StringTableHashTraits; ValueT = llvm::pdb::SrcHeaderBlockEntry]': ../include/llvm/ADT/SparseBitVector.h:129:15: warning: array subscript 2 is above array bounds of 'const BitWord [2]' {aka 'const long unsigned int [2]'} [-Warray-bounds] 129 | if (Bits[i] != 0) | ~~~~^ ../include/llvm/ADT/SparseBitVector.h:54:11: note: while referencing 'llvm::SparseBitVectorElement<128>::Bits' 54 | BitWord Bits[BITWORDS_PER_ELEMENT]; | ^~~~ ../include/llvm/ADT/SparseBitVector.h: In member function 'llvm::Error llvm::pdb::PDBFileBuilder::finalizeMsfLayout()': ../include/llvm/ADT/SparseBitVector.h:138:15: warning: array subscript 4294967295 is above array bounds of 'const BitWord [2]' {aka 'const long unsigned int [2]'} [-Warray-bounds] 138 | if (Bits[Idx] != 0) | ~~~~^ ../include/llvm/ADT/SparseBitVector.h:54:11: note: while referencing 'llvm::SparseBitVectorElement<128>::Bits' 54 | BitWord Bits[BITWORDS_PER_ELEMENT]; | ^~~~ ../include/llvm/ADT/SparseBitVector.h:138:15: warning: array subscript 4294967295 is above array bounds of 'const BitWord [2]' {aka 'const long unsigned int [2]'} [-Warray-bounds] 138 | if (Bits[Idx] != 0) | ~~~~^ ../include/llvm/ADT/SparseBitVector.h:54:11: note: while referencing 'llvm::SparseBitVectorElement<128>::Bits' 54 | BitWord Bits[BITWORDS_PER_ELEMENT]; | ^~~~ [1035/4271] Building CXX object lib/DebugInfo/PDB/CMakeFiles/LLVMDebugInfoPDB.dir/Native/TpiStream.cpp.o In file included from ../include/llvm/DebugInfo/PDB/Native/HashTable.h:12, from ../include/llvm/DebugInfo/PDB/Native/TpiStream.h:13, from ../lib/DebugInfo/PDB/Native/TpiStream.cpp:9: ../include/llvm/ADT/SparseBitVector.h: In member function 'llvm::Error llvm::pdb::HashTable<ValueT>::load(llvm::BinaryStreamReader&) [with ValueT = llvm::support::detail::packed_endian_specific_integral<unsigned int, llvm::support::little, 1>]': ../include/llvm/ADT/SparseBitVector.h:129:15: warning: array subscript 2 is above array bounds of 'const BitWord [2]' {aka 'const long unsigned int [2]'} [-Warray-bounds] 129 | if (Bits[i] != 0) | ~~~~^ ../include/llvm/ADT/SparseBitVector.h:54:11: note: while referencing 'llvm::SparseBitVectorElement<128>::Bits' 54 | BitWord Bits[BITWORDS_PER_ELEMENT]; | ^~~~ ../include/llvm/ADT/SparseBitVector.h:129:15: warning: array subscript 2 is above array bounds of 'const BitWord [2]' {aka 'const long unsigned int [2]'} [-Warray-bounds] 129 | if (Bits[i] != 0) | ~~~~^ ../include/llvm/ADT/SparseBitVector.h:54:11: note: while referencing 'llvm::SparseBitVectorElement<128>::Bits' 54 | BitWord Bits[BITWORDS_PER_ELEMENT]; | ^~~~ [1084/4271] Building CXX object lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RTDyldMemoryManager.cpp. FAILED: lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RTDyldMemoryManager.cpp.o /usr/local/bin/g++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/ExecutionEngine/RuntimeDyld -I../lib/ExecutionEngine/RuntimeDyld -Iinclude -I../include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fno-exceptions -fno-rtti -std=c++14 -MD -MT lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RTDyldMemoryManager.cpp.o -MF lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RTDyldMemoryManager.cpp.o.d -o lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RTDyldMemoryManager.cpp.o -c ../lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp ../lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp:295:1: error: implicit_section flag is set but section isn't 295 | } // namespace llvm | ^ *.LTHUNK4/2647 (void llvm::RTDyldMemoryManager::*.LTHUNK4()) @0x7f0869612dd0 Type: function definition analyzed alias cpp_implicit_alias Visibility: prevailing_def_ironly (implicit_section) artificial References: _ZN4llvm18MCJITMemoryManager6anchorEv/2649 (alias) Referring: Availability: available Function flags: Called by: _ZThn16_N4llvm19RTDyldMemoryManager6anchorEv/2648 Calls: during IPA pass: icf ../lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp:295:1: internal compiler error: verify_cgraph_node failed 0xbf89d8 cgraph_node::verify_node() ../../gcc/gcc/cgraph.c:3807 0xbe7ef4 symtab_node::verify() ../../gcc/gcc/symtab.c:1356 0xbe9182 symtab_node::verify_symtab_nodes() ../../gcc/gcc/symtab.c:1384 0xe72896 symtab_node::checking_verify_symtab_nodes() ../../gcc/gcc/cgraph.h:675 0xe72896 symbol_table::remove_unreachable_nodes(_IO_FILE*) ../../gcc/gcc/ipa.c:679 0xf7dd29 execute_todo ../../gcc/gcc/passes.c:2107 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. [1097/4271] Building CXX object lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyldELF.cpp.o ninja: build stopped: subcommand failed.
Can you please provide a pre-processed source file (-E option)?
Not needed, I was able to reproduce it. Reducing now..
Reduced test-case: $ cat mm.ii class JITSymbolResolver { virtual void anchor(); }; class MemoryManager { virtual void anchor(); }; class MCJITMemoryManager : MemoryManager { void anchor(); }; class RTDyldMemoryManager : MCJITMemoryManager, JITSymbolResolver { void anchor(); }; void RTDyldMemoryManager::anchor() {} void MCJITMemoryManager::anchor() {} $ g++ mm.ii -O3 -ffunction-sections -c mm.ii:14:36: error: implicit_section flag is set but section isn’t 14 | void MCJITMemoryManager::anchor() {} | ^ *.LTHUNK0/1 (void RTDyldMemoryManager::*.LTHUNK0()) @0x7ffff7742440 Type: function definition analyzed alias cpp_implicit_alias Visibility: prevailing_def_ironly (implicit_section) artificial References: _ZN18MCJITMemoryManager6anchorEv/3 (alias) Referring: Availability: available Function flags: Called by: _ZThn8_N19RTDyldMemoryManager6anchorEv/2 (can throw external) Calls: during IPA pass: icf mm.ii:14:36: internal compiler error: verify_cgraph_node failed 0xc05900 cgraph_node::verify_node() /home/marxin/Programming/gcc/gcc/cgraph.c:3807 0xbf5974 symtab_node::verify() /home/marxin/Programming/gcc/gcc/symtab.c:1356 0xbf6b3e symtab_node::verify_symtab_nodes() /home/marxin/Programming/gcc/gcc/symtab.c:1384 0xe6dd86 symtab_node::checking_verify_symtab_nodes() /home/marxin/Programming/gcc/gcc/cgraph.h:675 0xe6dd86 symbol_table::remove_unreachable_nodes(_IO_FILE*) /home/marxin/Programming/gcc/gcc/ipa.c:679 0xf72e99 execute_todo /home/marxin/Programming/gcc/gcc/passes.c:2107 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. I'm gonna fix it.
I've got a patch candidate.
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>: https://gcc.gnu.org/g:cbc4ae2b263bced781a2d2d0cf0085d262040db6 commit r11-5600-gcbc4ae2b263bced781a2d2d0cf0085d262040db6 Author: Martin Liska <mliska@suse.cz> Date: Mon Nov 30 13:07:27 2020 +0100 IPA: drop implicit_section again As mentioned in the PR, since 4656461585bfd0b9 implicit_section was not set to false when set_section was called with the argument equal to NULL. gcc/ChangeLog: PR ipa/98057 * symtab.c (symtab_node::set_section_for_node): Drop implicit_section if x_section is NULL. gcc/testsuite/ChangeLog: PR ipa/98057 * g++.dg/ipa/pr98057.C: New test.
Fixed on master.