-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
array-bounds warnigns building clang with gcc 4.9.1 #23709
Comments
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" .. |
OK, in the absence of any evidence of a real bug here, I think we should turn off this warning when building with GCC. |
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. |
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 O << AsmStrs+(Bits & 4095)-1; |
too old, closing |
Extended Description
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;
^
The text was updated successfully, but these errors were encountered: