<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">FWIW these are all emitted by recent versions of gcc, for SmallVectorImpl::insert(), in llvm/include/llvm/ADT/SmallVector.h:<div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class=""><div class="">   513    iterator insert(iterator I, T &&Elt) {</div><div class="">   514      if (I == this->end()) {  // Important special case for empty vector.</div><div class="">   515        this->push_back(::std::move(Elt));</div><div class="">   516        return this->end()-1;</div><div class="">   517      }</div><div class="">   518</div><div class="">   519      assert(I >= this->begin() && "Insertion iterator is out of bounds.");</div><div class="">   520      assert(I <= this->end() && "Inserting past the end of the vector.");</div><div class="">   521</div><div class="">   522      if (this->size() >= this->capacity()) {</div><div class="">   523        size_t EltNo = I-this->begin();</div><div class="">   524        this->grow();</div><div class="">   525        I = this->begin()+EltNo;</div><div class="">   526      }</div><div class="">   527</div><div class="">   528      ::new ((void*) this->end()) T(::std::move(this->back()));</div><div class="">   529      // Push everything else over.</div><div class="">   530      std::move_backward(I, this->end()-1, this->end());</div><div class="">   531      this->set_size(this->size() + 1);</div><div class="">   532</div><div class="">   533      // If we just moved the element we're inserting, be sure to update</div><div class="">   534      // the reference.</div><div class="">   535      T *EltPtr = &Elt;</div><div class="">   536      if (I <= EltPtr && EltPtr < this->end())</div><div class="">-> 537        ++EltPtr;</div><div class="">   538</div><div class="">   539      *I = ::std::move(*EltPtr);</div><div class="">   540      return I;</div><div class="">   541    }</div></font></div><div class=""><br class=""></div><div class="">For example:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">In file included from /home/dim/src/llvm/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:14,</font></div><div class=""><font face="Menlo" class="">                 from /home/dim/src/llvm/llvm-project/llvm/include/llvm/IR/DataLayout.h:22,</font></div><div class=""><font face="Menlo" class="">                 from /home/dim/src/llvm/llvm-project/llvm/lib/IR/DataLayout.cpp:18:</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h: In member function ‘llvm::Error llvm::DataLayout::setAlignment(llvm::AlignTypeEnum, llvm::Align, llvm::Align, uint32_t)’:</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h:537:7: warning: array subscript 8 is outside array bounds of ‘llvm::LayoutAlignElem [1]’ [-Warray-bounds]</font></div><div class=""><font face="Menlo" class="">  537 |       ++EltPtr;</font></div><div class=""><font face="Menlo" class="">      |       ^~</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/lib/IR/DataLayout.cpp:573:68: note: while referencing ‘<anonymous>’</font></div><div class=""><font face="Menlo" class="">  573 |                                               pref_align, bit_width));</font></div><div class=""><font face="Menlo" class="">      |                                                                    ^</font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><div class=""><font face="Menlo" class="">In file included from /home/dim/src/llvm/llvm-project/llvm/lib/CodeGen/BranchRelaxation.cpp:9:</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h: In member function ‘llvm::MachineBasicBlock* {anonymous}::BranchRelaxation::createNewBlockAfter(llvm::MachineBasicBlock&)’:</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h:537:7: warning: array subscript 1 is outside array bounds of ‘{anonymous}::BranchRelaxation::BasicBlockInfo [1]’ [-Warray-bounds]</font></div><div class=""><font face="Menlo" class="">  537 |       ++EltPtr;</font></div><div class=""><font face="Menlo" class="">      |       ^~</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/lib/CodeGen/BranchRelaxation.cpp:213:75: note: while referencing ‘<anonymous>’</font></div><div class=""><font face="Menlo" class="">  213 |   BlockInfo.insert(BlockInfo.begin() + NewBB->getNumber(), BasicBlockInfo());</font></div><div class=""><font face="Menlo" class="">      |                                                                           ^</font></div><div class=""><font face="Menlo" class="">In file included from /home/dim/src/llvm/llvm-project/llvm/lib/CodeGen/BranchRelaxation.cpp:9:</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h: In member function ‘virtual bool {anonymous}::BranchRelaxation::runOnMachineFunction(llvm::MachineFunction&)’:</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h:537:7: warning: array subscript 1 is outside array bounds of ‘{anonymous}::BranchRelaxation::BasicBlockInfo [1]’ [-Warray-bounds]</font></div><div class=""><font face="Menlo" class="">  537 |       ++EltPtr;</font></div><div class=""><font face="Menlo" class="">      |       ^~</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/lib/CodeGen/BranchRelaxation.cpp:240:75: note: while referencing ‘<anonymous>’</font></div><div class=""><font face="Menlo" class="">  240 |   BlockInfo.insert(BlockInfo.begin() + NewBB->getNumber(), BasicBlockInfo());</font></div><div class=""><font face="Menlo" class="">      |                                                                           ^</font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><div class=""><font face="Menlo" class="">In file included from /home/dim/src/llvm/llvm-project/llvm/include/llvm/CodeGen/ExecutionDomainFix.h:25,</font></div><div class=""><font face="Menlo" class="">                 from /home/dim/src/llvm/llvm-project/llvm/lib/CodeGen/ExecutionDomainFix.cpp:9:</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h: In member function ‘void llvm::ExecutionDomainFix::visitSoftInstr(llvm::MachineInstr*, unsigned int)’:</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h:566:7: warning: array subscript 1 is outside array bounds of ‘int [1]’ [-Warray-bounds]</font></div><div class=""><font face="Menlo" class="">  566 |       ++EltPtr;</font></div><div class=""><font face="Menlo" class="">      |       ^~</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/lib/CodeGen/ExecutionDomainFix.cpp:330:12: note: while referencing ‘rx’</font></div><div class=""><font face="Menlo" class="">  330 |   for (int rx : used) {</font></div><div class=""><font face="Menlo" class="">      |            ^~</font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><div class=""><font face="Menlo" class="">In file included from /home/dim/src/llvm/llvm-project/llvm/include/llvm/ADT/SmallSet.h:18,</font></div><div class=""><font face="Menlo" class="">                 from /home/dim/src/llvm/llvm-project/llvm/lib/CodeGen/ReachingDefAnalysis.cpp:9:</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h: In member function ‘void llvm::ReachingDefAnalysis::reprocessBasicBlock(llvm::MachineBasicBlock*)’:</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h:566:7: warning: array subscript 1 is outside array bounds of ‘const llvm::ReachingDef [1]’ [-Warray-bounds]</font></div><div class=""><font face="Menlo" class="">  566 |       ++EltPtr;</font></div><div class=""><font face="Menlo" class="">      |       ^~</font></div><div class=""><font face="Menlo" class="">/home/dim/src/llvm/llvm-project/llvm/lib/CodeGen/ReachingDefAnalysis.cpp:174:59: note: while referencing ‘<anonymous>’</font></div><div class=""><font face="Menlo" class="">  174 |         MBBReachingDefs[MBBNumber][Unit].insert(Start, Def);</font></div><div class=""><font face="Menlo" class="">      |                                                           ^</font></div></div><div class=""><br class=""></div><div class="">I think these are all false positives, but maybe somebody with more knowledge about SmallVectorImpl internals can comment. :)</div><div class=""><br class=""></div><div class="">-Dimitry</div><div><br class=""><blockquote type="cite" class=""><div class="">On 5 Sep 2020, at 13:50, Luke A. Guest via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi,<br class=""><br class="">Built llvm/clang 10.0.1 on Gentoo today and got the folowing error<br class="">building clang:<br class=""><br class="">*   LLVM_BUILD_TESTS<br class=""><br class=""> * QA Notice: Package triggers severe warnings which indicate that it<br class=""> *            may exhibit random runtime failures.<br class=""> * /usr/lib/llvm/10/include/llvm/ADT/SmallVector.h:491:7: warning: array<br class="">subscript 1 is outside array bounds of ‘char [1]’ [-Warray-bounds]<br class=""> * /usr/lib/llvm/10/include/llvm/ADT/SmallVector.h:491:7: warning: array<br class="">subscript 1 is outside array bounds of ‘clang::CanQualType [1]’ {aka<br class="">‘clang::CanQual<clang::Type> [1]’} [-Warray-bounds]<br class=""> * /usr/lib/llvm/10/include/llvm/ADT/SmallVector.h:491:7: warning: array<br class="">subscript 1 is outside array bounds of ‘char [1]’ [-Warray-bounds]<br class=""> * /usr/lib/llvm/10/include/llvm/ADT/SmallVector.h:491:7: warning: array<br class="">subscript 1 is outside array bounds of ‘clang::CanQualType [1]’ {aka<br class="">‘clang::CanQual<clang::Type> [1]’} [-Warray-bounds]<br class=""> * /usr/lib/llvm/10/include/llvm/ADT/SmallVector.h:491:7: warning: array<br class="">subscript 1 is outside array bounds of ‘char [1]’ [-Warray-bounds]<br class=""><br class=""> * Please do not file a Gentoo bug and instead report the above QA<br class=""> * issues directly to the upstream developers of this software.<br class=""> * Homepage: <a href="https://llvm.org/" class="">https://llvm.org/</a><br class="">strip: x86_64-pc-linux-gnu-strip --strip-unneeded -N<br class="">__gentoo_check_ldflags__ -R .comment -R .GCC.command.line -R<br class="">.note.gnu.gold-version<br class="">   /usr/lib/llvm/10/bin/pp-trace<br class="">   /usr/lib/llvm/10/bin/diagtool<br class="">   /usr/lib/llvm/10/bin/clang-10<br class="">   /usr/lib/llvm/10/lib32/libclang.so.10<br class="">   /usr/lib/llvm/10/lib32/libclang-cpp.so.10<br class=""><br class=""><br class=""><a href="https://bugs.gentoo.org/740456" class="">https://bugs.gentoo.org/740456</a><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class="">llvm-dev@lists.llvm.org<br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></div></blockquote></div><br class=""></div></body></html>