Thread model: posix gcc version 4.9.1 (i686-posix-dwarf-rev1cee, Built by MinGW-W64 project) [ 76%] Building CXX object lib/Target/AArch64/CMakeFiles/LLVMAArch64CodeGen.dir/AArch64AddressTypePromotion.cpp.obj In file included from C:/llvm/tools/clang/include/clang/Basic/PartialDiagnostic.h:19:0, from C:/llvm/tools/clang/include/clang/AST/DeclarationName.h:17, from C:/llvm/tools/clang/include/clang/AST/DeclBase.h:18, from C:/llvm/tools/clang/include/clang/AST/Decl.h:18, from C:/llvm/tools/clang/include/clang/AST/ASTTypeTraits.h:20, from C:/llvm/tools/clang/include/clang/AST/ASTContext.h:18, from C:/llvm/tools/clang/include/clang/Sema/SemaInternal.h:18, from C:/llvm/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp:13: C:/llvm/tools/clang/include/clang/Basic/Diagnostic.h: In member function 'bool clang::Sema::InstantiatingTemplate::CheckInstantiationDepth(clang::SourceLocation, clang::SourceRange)': C:/llvm/tools/clang/include/clang/Basic/Diagnostic.h:983:39: warning: array subscript is above array bounds [-Warray-bounds] DiagObj->DiagArgumentsKind[NumArgs] = Kind; ^ C:/llvm/tools/clang/include/clang/Basic/Diagnostic.h:984:40: warning: array subscript is above array bounds [-Warray-bounds] DiagObj->DiagArgumentsVal[NumArgs++] = V; ^ C:/llvm/tools/clang/include/clang/Basic/Diagnostic.h:983:39: warning: array subscript is above array bounds [-Warray-bounds] DiagObj->DiagArgumentsKind[NumArgs] = Kind; ^ C:/llvm/tools/clang/include/clang/Basic/Diagnostic.h:984:40: warning: array subscript is above array bounds [-Warray-bounds] DiagObj->DiagArgumentsVal[NumArgs++] = V; ^ C:/llvm/tools/clang/include/clang/Basic/Diagnostic.h:983:39: warning: array subscript is above array bounds [-Warray-bounds] DiagObj->DiagArgumentsKind[NumArgs] = Kind; ^ C:/llvm/tools/clang/include/clang/Basic/Diagnostic.h:984:40: warning: array subscript is above array bounds [-Warray-bounds] DiagObj->DiagArgumentsVal[NumArgs++] = V; ^ C:/llvm/tools/clang/include/clang/Basic/Diagnostic.h:983:39: warning: array subscript is above array bounds [-Warray-bounds] DiagObj->DiagArgumentsKind[NumArgs] = Kind; ^ C:/llvm/tools/clang/include/clang/Basic/Diagnostic.h:984:40: warning: array subscript is above array bounds [-Warray-bounds] DiagObj->DiagArgumentsVal[NumArgs++] = V; ^
That diagnostic is either useless (it doesn't say which call leads to the invalid array indexing) or wrong (perhaps because GCC unrolled a loop and then determined some late iteration of it would index out of bounds). Where is the -Warray-bounds coming from? Is this specified by our build system by default, or are you explicitly specifying that? (If the former, we should probably disable it when building with GCC if it's broken.)
I'm not specifying it, it's all default. The warning appears repeats several more times when included from other source files. The exact build commands are: cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DLLVM_DEFAULT_TARGET_TRIPLE=i686-pc-windows-gnu -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=ON -DLLVM_INCLUDE_DOCS=OFF -DLLVM_ENABLE_THREADS:BOOL=OFF -DCMAKE_EXE_LINKER_FLAGS="-Wl,--large-address-aware" .. mingw32-make
OK, in the absence of any evidence of a real bug here, I think we should turn off this warning when building with GCC.
Created attachment 14254 [details] Turn off array-bounds warning
CC'ing cmake build system maintainer. I think this should be guarded by CMAKE_COMPILER_IS_GNUCXX. Clang's -Warray-bounds is not broken in this way.
Created attachment 14262 [details] Turn off warning for g++
(In reply to comment #6) > Created attachment 14262 [details] > Turn off warning for g++ As always, please send patches to the commits list rather than updating isolated bugs.
Here is the full list of array-bounds warnings with gcc 4.9.1: Building CXX object lib/Transforms/InstCombine/CMakeFiles/LLVMInstCombine.dir/InstCombinePHI.cpp.obj c:/llvm/lib/IR/Function.cpp: In function 'std::string llvm::Intrinsic::getName(llvm::Intrinsic::ID, llvm::ArrayRef<llvm::Type*>)': c:/llvm/lib/IR/Function.cpp:514:30: warning: array subscript is above array bounds [-Warray-bounds] std::string Result(Table[id]); ^ [ 79%] Building CXX object lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/ARMAsmPrinter.cpp.obj In file included from c:/llvm/lib/Target/AArch64/AArch64ISelLowering.h:22:0, from c:/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:14: c:/llvm/include/llvm/Target/TargetLowering.h: In member function 'void llvm::AArch64TargetLowering::addTypeForNEON(llvm::EVT, llvm::EVT)': c:/llvm/include/llvm/Target/TargetLowering.h:1317:64: warning: array subscript is above array bounds [-Warray-bounds] IndexedModeActions[(unsigned)VT.SimpleTy][IdxMode] &= ~0xf0; ^ c:/llvm/include/llvm/Target/TargetLowering.h:1317:64: warning: array subscript is above array bounds [-Warray-bounds] [ 79%] Building CXX object lib/Target/AArch64/CMakeFiles/LLVMAArch64CodeGen.dir/AArch64InstrInfo.cpp.obj [ 79%] Building CXX object lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/ARMBaseInstrInfo.cpp.obj [ 79%] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/ItaniumCXXABI.cpp.obj In file included from c:/llvm/tools/clang/include/clang/Basic/PartialDiagnostic.h:19:0, from c:/llvm/tools/clang/include/clang/AST/DeclarationName.h:17, from c:/llvm/tools/clang/include/clang/AST/DeclBase.h:18, from c:/llvm/tools/clang/include/clang/AST/Decl.h:18, from c:/llvm/tools/clang/include/clang/AST/ASTTypeTraits.h:20, from c:/llvm/tools/clang/include/clang/AST/ASTContext.h:18, from c:/llvm/tools/clang/include/clang/Sema/SemaInternal.h:18, from c:/llvm/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp:13: c:/llvm/tools/clang/include/clang/Basic/Diagnostic.h: In member function 'bool clang::Sema::InstantiatingTemplate::CheckInstantiationDepth(clang::SourceLocation, clang::SourceRange)': c:/llvm/tools/clang/include/clang/Basic/Diagnostic.h:983:39: warning: array subscript is above array bounds [-Warray-bounds] DiagObj->DiagArgumentsKind[NumArgs] = Kind; ^ c:/llvm/tools/clang/include/clang/Basic/Diagnostic.h:984:40: warning: array subscript is above array bounds [-Warray-bounds] DiagObj->DiagArgumentsVal[NumArgs++] = V; ^ c:/llvm/tools/clang/include/clang/Basic/Diagnostic.h:983:39: warning: array subscript is above array bounds [-Warray-bounds] DiagObj->DiagArgumentsKind[NumArgs] = Kind; ^ c:/llvm/tools/clang/include/clang/Basic/Diagnostic.h:984:40: warning: array subscript is above array bounds [-Warray-bounds] DiagObj->DiagArgumentsVal[NumArgs++] = V; ^ [ 79%] [ 79%] Building CXX object lib/Target/ARM/MCTargetDesc/CMakeFiles/LLVMARMDesc.dir/ARMAsmBackend.cpp.obj In file included from c:/llvm/lib/Target/ARM/InstPrinter/ARMInstPrinter.cpp:27:0: c:/llvm/gcc/lib/Target/ARM/ARMGenAsmWriter.inc: In member function 'void llvm::ARMInstPrinter::printInstruction(const llvm::MCInst*, const llvm::MCSubtargetInfo&, llvm::raw_ostream&)': c:/llvm/gcc/lib/Target/ARM/ARMGenAsmWriter.inc:6115:31: warning: array subscript is below array bounds [-Warray-bounds] O << AsmStrs+(Bits & 4095)-1; ^ [ 83%] Building CXX object lib/Target/Mips/MCTargetDesc/CMakeFiles/LLVMMipsDesc.dir/MipsAsmBackend.cpp.obj In file included from c:/llvm/lib/Target/Hexagon/Hexagon.h:19:0, from c:/llvm/lib/Target/Hexagon/HexagonISelLowering.h:18, from c:/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp:15: c:/llvm/include/llvm/Target/TargetLowering.h: In member function 'void llvm::HexagonTargetLowering::promoteLdStType(llvm::EVT, llvm::EVT)': c:/llvm/include/llvm/Target/TargetLowering.h:1287:36: warning: array subscript is above array bounds [-Warray-bounds] OpActions[(unsigned)VT.SimpleTy][Op] = (uint8_t)Action; ^ c:/llvm/include/llvm/Target/TargetLowering.h: In constructor 'llvm::HexagonTargetLowering::HexagonTargetLowering(const llvm::TargetMachine&, const llvm::HexagonSubtarget&)': c:/llvm/include/llvm/Target/TargetLowering.h:1317:64: warning: array subscript is above array bounds [-Warray-bounds] IndexedModeActions[(unsigned)VT.SimpleTy][IdxMode] &= ~0xf0; ^ c:/llvm/include/llvm/Target/TargetLowering.h:1317:64: warning: array subscript is above array bounds [-Warray-bounds]
too old, closing