Skip to content

[BoundsSafety] Bring full support for -fbounds-safety #9665

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

Conversation

rapidsna
Copy link

-fbounds-safety is a C extension to enforce bounds safety to prevent out-of-bounds (OOB) memory accesses. The extension offers bounds annotations that programmers can use to attach bounds to pointers. Using this bounds information, the compiler inserts bounds checks on every pointer dereference, ensuring that the program does not access memory outside the specified bounds. The compiler requires programmers to provide enough bounds information so that the accesses can be checked at either run time or compile time — and it rejects code if it cannot.

For more details, please refer to

The bounds annotations provided by -fbounds-safety could potentially be useful to implement safe interoperation between C/C++ and safe languages such as Swift. Similar to lifetime dependency annotations as pitched here.

This patch contains collaborative work from @rapidsna @apple-fcloutier @patrykstefanski @delcypher @hnrklssn and from many other collaborators from the optimization and debugger side of support.

@rapidsna
Copy link
Author

@swift-ci test

@rapidsna
Copy link
Author

@swift-ci test llvm

@rapidsna rapidsna requested a review from fhahn November 22, 2024 02:08
@delcypher delcypher requested review from delcypher and removed request for danliew-apple November 22, 2024 14:59
@delcypher
Copy link

Looks like there's some problems building with gcc.

/home/build-user/llvm-project/clang/lib/Analysis/BoundsSafetySuggestions.cpp:452:45: error: designator order for field 'clang::BoundsSafetySuggestionHandler::SingleEntity::Kind' does not match declaration order in 'clang::BoundsSafetySuggestionHandler::SingleEntity'
  452 |           .SinglePointeeTy = SinglePointeeTy};
      |                                             ^
/home/build-user/llvm-project/clang/lib/Analysis/BoundsSafetySuggestions.cpp:460:11: warning: C++ designated initializers only available with '-std=c++2a' or '-std=gnu++2a' [-Wpedantic]
  460 |           .Entity = SingleVarDecl,

and then a whole bunch of warnings. This are all the ones that obviously looked like they were due to -fbounds-safety code from this Linux build

[1495/4939] /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/llvm-project/build/tools/clang/lib/AST -I/home/build-user/llvm-project/clang/lib/AST -I/home/build-user/llvm-project/clang/include -I/home/build-user/llvm-project/build/tools/clang/include -I/home/build-user/llvm-project/build/include -I/home/build-user/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/Expr.cpp.o -MF tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/Expr.cpp.o.d -o tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/Expr.cpp.o -c /home/build-user/llvm-project/clang/lib/AST/Expr.cpp
/home/build-user/llvm-project/clang/lib/AST/Expr.cpp: In member function 'bool clang::Expr::isConstantInitializer(clang::ASTContext&, bool, const clang::Expr**) const':
/home/build-user/llvm-project/clang/lib/AST/Expr.cpp:3760:23: warning: unused variable 'DCPTy' [-Wunused-variable]
 3760 |             if (auto *DCPTy = Field->getType()->getAs<CountAttributedType>()) {
      |                       ^~~~~
/home/build-user/llvm-project/clang/lib/AST/Expr.cpp: In member function 'llvm::StringRef clang::PredefinedBoundsCheckExpr::getKindName() const':
/home/build-user/llvm-project/clang/lib/AST/Expr.cpp:2301:1: warning: control reaches end of non-void function [-Wreturn-type]
 2301 | }
      | ^
[407/4939] /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/llvm-project/build/lib/Remarks -I/home/build-user/llvm-project/llvm/lib/Remarks -I/home/build-user/llvm-project/build/include -I/home/build-user/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT lib/Remarks/CMakeFiles/LLVMRemarks.dir/ExtraOptRemarks.cpp.o -MF lib/Remarks/CMakeFiles/LLVMRemarks.dir/ExtraOptRemarks.cpp.o.d -o lib/Remarks/CMakeFiles/LLVMRemarks.dir/ExtraOptRemarks.cpp.o -c /home/build-user/llvm-project/llvm/lib/Remarks/ExtraOptRemarks.cpp
In file included from /home/build-user/llvm-project/llvm/lib/Remarks/ExtraOptRemarks.cpp:11:
/home/build-user/llvm-project/llvm/include/llvm/Remarks/BoundsSafetyOptRemarks.h:32: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   32 | #pragma clang diagnostic push
      | 
/home/build-user/llvm-project/llvm/include/llvm/Remarks/BoundsSafetyOptRemarks.h:33: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   33 | #pragma clang diagnostic ignored "-Wcovered-switch-default"
      | 
[1564/4939] /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/llvm-project/build/tools/clang/lib/AST -I/home/build-user/llvm-project/clang/lib/AST -I/home/build-user/llvm-project/clang/include -I/home/build-user/llvm-project/build/tools/clang/include -I/home/build-user/llvm-project/build/include -I/home/build-user/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ExprConstant.cpp.o -MF tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ExprConstant.cpp.o.d -o tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ExprConstant.cpp.o -c /home/build-user/llvm-project/clang/lib/AST/ExprConstant.cpp
/home/build-user/llvm-project/clang/lib/AST/ExprConstant.cpp: In member function 'bool {anonymous}::PointerExprEvaluator::VisitCastExpr(const clang::CastExpr*)':
/home/build-user/llvm-project/clang/lib/AST/ExprConstant.cpp:9738:14: warning: unused variable 'DRP' [-Wunused-variable]
 9738 |     if (auto DRP = E->getType()->getAs<DynamicRangePointerType>()) {
      |              ^~~
[84/4464] /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/llvm-project/build/tools/clang/lib/Sema -I/home/build-user/llvm-project/clang/lib/Sema -I/home/build-user/llvm-project/clang/include -I/home/build-user/llvm-project/build/tools/clang/include -I/home/build-user/llvm-project/build/include -I/home/build-user/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/AnalysisBasedWarnings.cpp.o -MF tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/AnalysisBasedWarnings.cpp.o.d -o tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/AnalysisBasedWarnings.cpp.o -c /home/build-user/llvm-project/clang/lib/Sema/AnalysisBasedWarnings.cpp
/home/build-user/llvm-project/clang/lib/Sema/AnalysisBasedWarnings.cpp: In member function 'int BoundsSafetySuggestionReporter::WillTrapKindSelectIndex(clang::BoundsSafetySuggestionHandler::WillTrapKind)':
/home/build-user/llvm-project/clang/lib/Sema/AnalysisBasedWarnings.cpp:2527:3: warning: control reaches end of non-void function [-Wreturn-type]
 2527 |   }
      |   ^
/home/build-user/llvm-project/clang/lib/Sema/AnalysisBasedWarnings.cpp: In member function 'int BoundsSafetySuggestionReporter::PtrArithOOBKindSelectIndex(clang::BoundsSafetySuggestionHandler::PtrArithOOBKind)':
/home/build-user/llvm-project/clang/lib/Sema/AnalysisBasedWarnings.cpp:2547:3: warning: control reaches end of non-void function [-Wreturn-type]
 2547 |   }
      |   ^
[251/4464] /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/llvm-project/build/tools/clang/lib/Sema -I/home/build-user/llvm-project/clang/lib/Sema -I/home/build-user/llvm-project/clang/include -I/home/build-user/llvm-project/build/tools/clang/include -I/home/build-user/llvm-project/build/include -I/home/build-user/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDecl.cpp.o -MF tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDecl.cpp.o.d -o tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDecl.cpp.o -c /home/build-user/llvm-project/clang/lib/Sema/SemaDecl.cpp
/home/build-user/llvm-project/clang/lib/Sema/SemaDecl.cpp: In function 'bool mergeFunctionDeclBoundsAttributes(clang::FunctionDecl*, clang::FunctionDecl*, clang::Sema&)':
/home/build-user/llvm-project/clang/lib/Sema/SemaDecl.cpp:4050:22: warning: unused variable 'FT' [-Wunused-variable]
 4050 |     } else if (auto *FT = New->getType()->getAs<FunctionNoProtoType>()) {
      |                      ^~
/home/build-user/llvm-project/clang/lib/Sema/SemaDecl.cpp: In function 'bool mergeFunctionDeclTerminatedByAttribute(clang::FunctionDecl*, clang::FunctionDecl*, clang::Sema&)':
/home/build-user/llvm-project/clang/lib/Sema/SemaDecl.cpp:4168:22: warning: unused variable 'FT' [-Wunused-variable]
 4168 |     } else if (auto *FT = New->getType()->getAs<FunctionNoProtoType>()) {
      |                      ^~
[256/4464] /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/llvm-project/build/tools/clang/lib/Sema -I/home/build-user/llvm-project/clang/lib/Sema -I/home/build-user/llvm-project/clang/include -I/home/build-user/llvm-project/build/tools/clang/include -I/home/build-user/llvm-project/build/include -I/home/build-user/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/DynamicCountPointerAssignmentAnalysis.cpp.o -MF tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/DynamicCountPointerAssignmentAnalysis.cpp.o.d -o tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/DynamicCountPointerAssignmentAnalysis.cpp.o -c /home/build-user/llvm-project/clang/lib/Sema/DynamicCountPointerAssignmentAnalysis.cpp
/home/build-user/llvm-project/clang/lib/Sema/DynamicCountPointerAssignmentAnalysis.cpp: In function 'void {anonymous}::analyzeAssignedDeclCommon(clang::Sema&, clang::ValueDecl*, clang::QualType, {anonymous}::AssignedDeclRefResult&)':
/home/build-user/llvm-project/clang/lib/Sema/DynamicCountPointerAssignmentAnalysis.cpp:171:13: warning: unused variable 'DCPTy' [-Wunused-variable]
  171 |   if (auto *DCPTy = Ty->getAs<CountAttributedType>()) {
      |             ^~~~~
/home/build-user/llvm-project/clang/lib/Sema/DynamicCountPointerAssignmentAnalysis.cpp: In member function 'void {anonymous}::PreAssignCheck::buildAndChain(clang::QualType, clang::Expr*)':
/home/build-user/llvm-project/clang/lib/Sema/DynamicCountPointerAssignmentAnalysis.cpp:839:21: warning: unused variable 'DBPTy' [-Wunused-variable]
  839 |     if (const auto *DBPTy = Ty->getAs<BoundsAttributedType>()) {
      |                     ^~~~~
/home/build-user/llvm-project/clang/lib/Sema/DynamicCountPointerAssignmentAnalysis.cpp: In function 'bool {anonymous}::diagnoseRecordInitsImpl(clang::Sema&, clang::InitListExpr*, bool&, bool, llvm::SmallVectorImpl<clang::Expr*>&)':
/home/build-user/llvm-project/clang/lib/Sema/DynamicCountPointerAssignmentAnalysis.cpp:2393:13: warning: unused variable 'AT' [-Wunused-variable]
 2393 |   if (auto *AT = SemaRef.Context.getAsArrayType(IL->getType())) {
      |             ^~
/home/build-user/llvm-project/clang/lib/Sema/DynamicCountPointerAssignmentAnalysis.cpp: In member function 'clang::Expr* {anonymous}::CheckCountAttributedDeclAssignments::HandleInitListExpr(clang::InitListExpr*, {anonymous}::PreAssignCheck&)':
/home/build-user/llvm-project/clang/lib/Sema/DynamicCountPointerAssignmentAnalysis.cpp:2617:24: warning: unused variable 'OrigDCPTy' [-Wunused-variable]
 2617 |       } else if (auto *OrigDCPTy = FD->getType()->getAs<CountAttributedType>()) {
      |                        ^~~~~~~~~
/home/build-user/llvm-project/clang/lib/Sema/DynamicCountPointerAssignmentAnalysis.cpp:2654:13: warning: unused variable 'AT' [-Wunused-variable]
 2654 |   if (auto *AT = SemaRef.Context.getAsArrayType(IL->getType())) {
      |             ^~
[487/4464] /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/llvm-project/build/tools/clang/lib/Sema -I/home/build-user/llvm-project/clang/lib/Sema -I/home/build-user/llvm-project/clang/include -I/home/build-user/llvm-project/build/tools/clang/include -I/home/build-user/llvm-project/build/include -I/home/build-user/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExpr.cpp.o -MF tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExpr.cpp.o.d -o tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExpr.cpp.o -c /home/build-user/llvm-project/clang/lib/Sema/SemaExpr.cpp
/home/build-user/llvm-project/clang/lib/Sema/SemaExpr.cpp: In member function 'bool clang::Sema::isCompatibleBoundsUnsafeAssignment(clang::Sema::AssignConvertType) const':
/home/build-user/llvm-project/clang/lib/Sema/SemaExpr.cpp:12145:1: warning: control reaches end of non-void function [-Wreturn-type]
12145 | }
      | ^
[1405/4464] /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/llvm-project/build/tools/clang/lib/CodeGen -I/home/build-user/llvm-project/clang/lib/CodeGen -I/home/build-user/llvm-project/clang/include -I/home/build-user/llvm-project/build/tools/clang/include -I/home/build-user/llvm-project/build/include -I/home/build-user/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/BoundsSafetyOptRemarks.cpp.o -MF tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/BoundsSafetyOptRemarks.cpp.o.d -o tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/BoundsSafetyOptRemarks.cpp.o -c /home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyOptRemarks.cpp
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyOptRemarks.cpp:25: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   25 | #pragma clang diagnostic push
      | 
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyOptRemarks.cpp:26: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   26 | #pragma clang diagnostic ignored "-Wcovered-switch-default"
      | 
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyOptRemarks.cpp:29: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   29 | #pragma clang diagnostic pop
      | 
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyOptRemarks.cpp:46: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   46 | #pragma clang diagnostic push
      | 
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyOptRemarks.cpp:47: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   47 | #pragma clang diagnostic ignored "-Wcovered-switch-default"
      | 
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyOptRemarks.cpp:50: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   50 | #pragma clang diagnostic pop
      | 
[1410/4464] /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/llvm-project/build/tools/clang/lib/CodeGen -I/home/build-user/llvm-project/clang/lib/CodeGen -I/home/build-user/llvm-project/clang/include -I/home/build-user/llvm-project/build/tools/clang/include -I/home/build-user/llvm-project/build/include -I/home/build-user/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/BoundsSafetyTraps.cpp.o -MF tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/BoundsSafetyTraps.cpp.o.d -o tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/BoundsSafetyTraps.cpp.o -c /home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyTraps.cpp
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyTraps.cpp:77: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   77 | #pragma clang diagnostic push
      | 
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyTraps.cpp:78: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   78 | #pragma clang diagnostic ignored "-Wcovered-switch-default"
      | 
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyTraps.cpp:81: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
   81 | #pragma clang diagnostic pop
      | 
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyTraps.cpp: In function 'llvm::StringRef clang::CodeGen::GetBoundsSafetyTrapMessageSuffixWithContext(clang::CodeGen::BoundsSafetyTrapKind, clang::CodeGen::BoundsSafetyTrapCtx::Kind)':
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyTraps.cpp:26:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
   26 |     switch (TrapCtx) {
      |     ^~~~~~
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyTraps.cpp:40:3: note: here
   40 |   case BNS_TRAP_PTR_GT_UPPER_BOUND:
      |   ^~~~
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyTraps.cpp:42:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
   42 |     switch (TrapCtx) {
      |     ^~~~~~
/home/build-user/llvm-project/clang/lib/CodeGen/BoundsSafetyTraps.cpp:58:3: note: here
   58 |   default:
      |   ^~~~~~~
[1412/4464] /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/llvm-project/build/tools/clang/lib/CodeGen -I/home/build-user/llvm-project/clang/lib/CodeGen -I/home/build-user/llvm-project/clang/include -I/home/build-user/llvm-project/build/tools/clang/include -I/home/build-user/llvm-project/build/include -I/home/build-user/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGExprAgg.cpp.o -MF tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGExprAgg.cpp.o.d -o tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGExprAgg.cpp.o -c /home/build-user/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp
/home/build-user/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp: In member function 'void {anonymous}::AggExprEmitter::VisitBoundsSafetyPointerPromotionExpr(clang::BoundsSafetyPointerPromotionExpr*)':
/home/build-user/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:505:13: warning: unused variable 'LowerE' [-Wunused-variable]
  505 |   if (auto *LowerE = E->getLowerBound()) {
      |             ^~~~~~
[1428/4464] /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build-user/llvm-project/build/tools/clang/lib/CodeGen -I/home/build-user/llvm-project/clang/lib/CodeGen -I/home/build-user/llvm-project/clang/include -I/home/build-user/llvm-project/build/tools/clang/include -I/home/build-user/llvm-project/build/include -I/home/build-user/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGExpr.cpp.o -MF tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGExpr.cpp.o.d -o tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGExpr.cpp.o -c /home/build-user/llvm-project/clang/lib/CodeGen/CGExpr.cpp
/home/build-user/llvm-project/clang/lib/CodeGen/CGExpr.cpp: In member function 'clang::CodeGen::Address clang::CodeGen::CodeGenFunction::EmitArrayToWidePointerDecay(const clang::Expr*, llvm::Value*&, clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*, clang::CodeGen::TBAAAccessInfo*)':
/home/build-user/llvm-project/clang/lib/CodeGen/CGExpr.cpp:4718:17: warning: unused variable 'IAT' [-Wunused-variable]
 4718 |   else if (auto IAT = dyn_cast<IncompleteArrayType>(SrcTy)) {
      |                 ^~~

@delcypher
Copy link

For the macOS job we have test failures.

1 warning(s) in tests
********************
Failed Tests (15):
  LLVM :: Transforms/ConstraintElimination/gep-chains.ll
  LLVM :: Transforms/ConstraintElimination/geps-inbounds-precondition-ub-in-use-blocks.ll
  LLVM :: Transforms/ConstraintElimination/geps-inbounds-precondition.ll
  LLVM :: Transforms/ConstraintElimination/geps-precondition-overflow-check.ll
  LLVM :: Transforms/ConstraintElimination/large-system-growth.ll
  LLVM :: Transforms/ConstraintElimination/loops-bottom-tested-base.ll
  LLVM :: Transforms/ConstraintElimination/loops-bottom-tested-pointer-cmps.ll
  LLVM :: Transforms/ConstraintElimination/loops-header-tested-base.ll
  LLVM :: Transforms/ConstraintElimination/loops-header-tested-pointer-cmps.ll
  LLVM :: Transforms/ConstraintElimination/loops.ll
  LLVM :: Transforms/ConstraintElimination/reproducer-remarks.ll
  LLVM :: Transforms/ConstraintElimination/sext-unsigned-predicates.ll
  LLVM :: Transforms/ConstraintElimination/transfer-signed-facts-to-unsigned-is-known-non-negative.ll
  LLVM :: Transforms/ConstraintElimination/transfer-unsigned-facts-to-signed-is-known-non-negative.ll
  LLVM :: Transforms/Util/auto-init-annotation-remarks.ll

********************
Unexpectedly Passed Tests (1):
  Clang :: BoundsSafety/CodeGen/opt-remarks/bounds-safety-ptr-conversion-O2.c

@rapidsna
Copy link
Author

rapidsna commented Dec 2, 2024

@swift-ci test

@rapidsna
Copy link
Author

rapidsna commented Dec 2, 2024

@swift-ci llvm test

@rapidsna
Copy link
Author

rapidsna commented Dec 2, 2024

@swift-ci test

@rapidsna
Copy link
Author

rapidsna commented Dec 2, 2024

@swift-ci llvm test

@rapidsna rapidsna force-pushed the dev/yeoulna/upstream-bounds-safety-swift/release/6.1 branch from 6585ae0 to 23c753d Compare December 2, 2024 07:27
@rapidsna rapidsna force-pushed the dev/yeoulna/upstream-bounds-safety-swift/release/6.1 branch from 23c753d to 926ccb2 Compare December 2, 2024 07:29
@rapidsna
Copy link
Author

rapidsna commented Dec 2, 2024

@swift-ci test

@rapidsna rapidsna force-pushed the dev/yeoulna/upstream-bounds-safety-swift/release/6.1 branch from 926ccb2 to f5e6a4b Compare December 2, 2024 07:35
@rapidsna
Copy link
Author

rapidsna commented Dec 2, 2024

@swift-ci test

1 similar comment
@rapidsna
Copy link
Author

rapidsna commented Dec 2, 2024

@swift-ci test

@rapidsna
Copy link
Author

rapidsna commented Dec 4, 2024

@swift-ci test

Ensure APValue::DataSize is bigger than APValue::LV. To do so,
this moves APValue::LV to APValue.h so that we can always allocate
DataSize to be bigger than LV. Previously, LV was hidden in the
source file and the type size of DataSize didn't take it into
account even though it has to be bigger than LV. This made the
implementation quite fragile to any change in the size of related
components.

rdar://137823177
@rapidsna
Copy link
Author

rapidsna commented Dec 4, 2024

@swift-ci test

1 similar comment
@rapidsna
Copy link
Author

rapidsna commented Dec 4, 2024

@swift-ci test

@rapidsna rapidsna force-pushed the dev/yeoulna/upstream-bounds-safety-swift/release/6.1 branch from 024050a to c41a62d Compare December 4, 2024 06:42
@rapidsna
Copy link
Author

rapidsna commented Dec 4, 2024

@swift-ci test

@rapidsna rapidsna requested a review from Michael137 December 4, 2024 07:57
@rapidsna
Copy link
Author

rapidsna commented Dec 4, 2024

@swift-ci test

@rapidsna
Copy link
Author

rapidsna commented Dec 4, 2024

@swift-ci llvm test

@rapidsna rapidsna force-pushed the dev/yeoulna/upstream-bounds-safety-swift/release/6.1 branch from d9b4f7c to a8812a5 Compare December 5, 2024 01:54
@rapidsna
Copy link
Author

rapidsna commented Dec 5, 2024

@swift-ci test

@rapidsna
Copy link
Author

rapidsna commented Dec 5, 2024

@swift-ci test llvm

@delcypher delcypher added the clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang label Dec 6, 2024
@rapidsna rapidsna closed this Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants