[Sema] Fix lifetime extension for temporaries in range-based for loops in C++23
C++23 mandates that temporaries used in range-based for loops are lifetime-extended
to cover the full loop. This patch adds a check for loop variables and compiler-
generated __range bindings to apply the correct extension.
Includes test cases based on examples from CWG900/P2644R1.
Fixes https://github.com/llvm/llvm-project/issues/109793
Thank you for submitting a Pull Request (PR) to the LLVM Project!
This PR will be automatically labeled and the relevant teams will be notified.
If you wish to, you can add reviewers by using the "Reviewers" section on this page.
If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.
If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.
If you have further questions, they may be answered by the LLVM GitHub User Guide.
You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.
Could you associate this PR with the issue to fix, if any?
Could you associate this PR with the issue to fix, if any?
Done!
A couple of quick notes:
- This is my first LLVM PR, so if there are any issues with code style or conventions, please let me know!
- I'm not entirely satisfied with the
VD->getName().starts_with("__range")check, but it was the most reliable approach I found. Walking up the AST from the node didn’t seem feasible (likely due to optimizations?) and I noticed that pattern here: https://github.com/llvm/llvm-project/blob/075cb691a5e810f7114369c67b475dfd9127d4af/clang/lib/Sema/SemaStmt.cpp#L2481-L2485
@llvm/pr-subscribers-clang-modules
@llvm/pr-subscribers-clang
Author: Marco Vitale (mrcvtl)
Changes
C++23 mandates that temporaries used in range-based for loops are lifetime-extended
to cover the full loop. This patch adds a check for loop variables and compiler-
generated __range bindings to apply the correct extension.
Includes test cases based on examples from CWG900/P2644R1.
Fixes https://github.com/llvm/llvm-project/issues/109793
Full diff: https://github.com/llvm/llvm-project/pull/145164.diff
2 Files Affected:
- (modified) clang/lib/Sema/CheckExprLifetime.cpp (+28)
- (added) clang/test/SemaCXX/range-for-lifetime-cxx23.cpp (+79)
diff --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp
index 060ba31660556..0434aa0c29c26 100644
--- a/clang/lib/Sema/CheckExprLifetime.cpp
+++ b/clang/lib/Sema/CheckExprLifetime.cpp
@@ -57,6 +57,31 @@ enum LifetimeKind {
};
using LifetimeResult =
llvm::PointerIntPair<const InitializedEntity *, 3, LifetimeKind>;
+
+/// Returns true if the given entity is part of a range-based for loop and
+/// should trigger lifetime extension under C++23 rules.
+///
+/// This handles both explicit range loop variables and internal compiler-
+/// generated variables like `__range1`.
+static bool
+isRangeBasedForLoopVariable(const Sema &SemaRef,
+ const InitializedEntity *ExtendingEntity) {
+ if (!SemaRef.getLangOpts().CPlusPlus23)
+ return false;
+
+ const Decl *EntityDecl = ExtendingEntity->getDecl();
+ if (!EntityDecl)
+ return false;
+
+ if (const auto *VD = dyn_cast<VarDecl>(EntityDecl)) {
+ if (VD->isCXXForRangeDecl() || VD->getName().starts_with("__range")) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
} // namespace
/// Determine the declaration which an initialized entity ultimately refers to,
@@ -1341,6 +1366,9 @@ checkExprLifetimeImpl(Sema &SemaRef, const InitializedEntity *InitEntity,
}
if (IsGslPtrValueFromGslTempOwner && DiagLoc.isValid()) {
+ if (isRangeBasedForLoopVariable(SemaRef, ExtendingEntity))
+ return true;
+
SemaRef.Diag(DiagLoc, diag::warn_dangling_lifetime_pointer)
<< DiagRange;
return false;
diff --git a/clang/test/SemaCXX/range-for-lifetime-cxx23.cpp b/clang/test/SemaCXX/range-for-lifetime-cxx23.cpp
new file mode 100644
index 0000000000000..bb6e06ec4517c
--- /dev/null
+++ b/clang/test/SemaCXX/range-for-lifetime-cxx23.cpp
@@ -0,0 +1,79 @@
+// RUN: %clangxx -std=c++23 -fsyntax-only -Xclang -verify %s
+
+#include <string>
+#include <vector>
+#include <map>
+#include <tuple>
+#include <optional>
+#include <variant>
+#include <array>
+#include <span>
+
+static std::vector<std::string> getVector() {
+ return {"first", "second", "third"};
+}
+
+static std::map<std::string, std::vector<int>> getMap() {
+ return {{"key", {1, 2, 3}}};
+}
+
+static std::tuple<std::vector<double>> getTuple() {
+ return std::make_tuple(std::vector<double>{3.14, 2.71});
+}
+
+static std::optional<std::vector<char>> getOptionalColl() {
+ return std::vector<char>{'x', 'y', 'z'};
+}
+
+static std::variant<std::string, int> getVariant() {
+ return std::string("variant");
+}
+
+static const std::array<int, 4>& arrOfConst() {
+ static const std::array<int, 4> arr = {10, 20, 30, 40};
+ return arr;
+}
+
+static void testGetVectorSubscript() {
+ for (auto e : getVector()[0]) {
+ (void)e;
+ }
+}
+
+static void testGetMapSubscript() {
+ for (auto valueElem : getMap()["key"]) {
+ (void)valueElem;
+ }
+}
+
+static void testGetTuple() {
+ for (auto e : std::get<0>(getTuple())) {
+ (void)e;
+ }
+}
+
+static void testOptionalValue() {
+ for (auto e : getOptionalColl().value()) {
+ (void)e;
+ }
+}
+
+static void testVariantGetString() {
+ for (char c : std::get<std::string>(getVariant())) {
+ (void)c;
+ }
+}
+
+static void testSpanLastFromConstArray() {
+ for (auto s : std::span{arrOfConst()}.last(2)) {
+ (void)s;
+ }
+}
+
+static void testSpanFromVectorPtr() {
+ for (auto e : std::span(getVector().data(), 2)) {
+ (void)e;
+ }
+}
+
+// expected-no-diagnostics
A couple of quick notes:
- This is my first LLVM PR, so if there are any issues with code style or conventions, please let me know!
- I'm not entirely satisfied with the
VD->getName().starts_with("__range")check, but it was the most reliable approach I found. Walking up the AST from the node didn’t seem feasible (likely due to optimizations?) and I noticed that pattern here: https://github.com/llvm/llvm-project/blob/075cb691a5e810f7114369c67b475dfd9127d4af/clang/lib/Sema/SemaStmt.cpp#L2481-L2485
Thanks for you fix!
Maybe we can use isInLifetimeExtendingContext() instead of check the __range variable name. We usually get into an LifetimeExtendingContex in Sema. FYI, the initial PR is https://github.com/llvm/llvm-project/pull/76361.
I’ve taken some time to better understand the code and think through the solution.
I tried using isInLifetimeExtendingContext(), but it still returns false, and I believe I now understand why. In your PR, the flag is set here:
https://github.com/llvm/llvm-project/blob/b581f9d056babadf55098b9d5d100271621b90db/clang/lib/Parse/ParseDecl.cpp#L2314-L2318
However, the warning is actually triggered starting from this location: https://github.com/llvm/llvm-project/blob/b581f9d056babadf55098b9d5d100271621b90db/clang/lib/Parse/ParseDecl.cpp#L2266
An alternative approach would be to apply your logic and set again the flag in here: https://github.com/llvm/llvm-project/blob/43d042b350af8ee8c7401d6b102df68d6c176b5a/clang/lib/Parse/ParseStmt.cpp#L2174-L2179
Maybe we could act on ForRangeInfo.LifetimeExtendTemps.back(), or even directly on Actions.currentEvaluationContext();. If that works, we might be able to rely solely on isInLifetimeExtendingContext() and remove the need for isRangeBasedForLoopVariable altogether.
What do you think? I'm absolutely open to every approach (the cleaner, the better!).
I’ve taken some time to better understand the code and think through the solution.
I tried using
isInLifetimeExtendingContext(), but it still returns false, and I believe I now understand why. In your PR, the flag is set here:https://github.com/llvm/llvm-project/blob/b581f9d056babadf55098b9d5d100271621b90db/clang/lib/Parse/ParseDecl.cpp#L2314-L2318
However, the warning is actually triggered starting from this location:
https://github.com/llvm/llvm-project/blob/b581f9d056babadf55098b9d5d100271621b90db/clang/lib/Parse/ParseDecl.cpp#L2266
An alternative approach would be to apply your logic and set again the flag in here:
https://github.com/llvm/llvm-project/blob/43d042b350af8ee8c7401d6b102df68d6c176b5a/clang/lib/Parse/ParseStmt.cpp#L2174-L2179
Maybe we could act on
ForRangeInfo.LifetimeExtendTemps.back(), or even directly onActions.currentEvaluationContext();. If that works, we might be able to rely solely onisInLifetimeExtendingContext()and remove the need forisRangeBasedForLoopVariablealtogether.What do you think? I'm absolutely open to every approach (the cleaner, the better!).
IMO, we have 2 options:
- Add a flag variable into
ExpressionEvaluationContextRecord. Represent that we are initializing the for-range __range variable. Eg.
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 9397546c8fc5..c639a4b4af58 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -6786,6 +6786,9 @@ public:
/// Whether we should rebuild CXXDefaultArgExpr and CXXDefaultInitExpr.
bool RebuildDefaultArgOrDefaultInit = false;
+ /// Whether we are initializing a C++ for-range implicit variable '__range'.
+ bool InitCXXForRangeVar = false;
+
// When evaluating immediate functions in the initializer of a default
// argument or default member initializer, this is the declaration whose
// default initializer is being evaluated and the location of the call
diff --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp
index 060ba3166055..150e27f8acf7 100644
--- a/clang/lib/Sema/CheckExprLifetime.cpp
+++ b/clang/lib/Sema/CheckExprLifetime.cpp
@@ -1341,6 +1341,8 @@ checkExprLifetimeImpl(Sema &SemaRef, const InitializedEntity *InitEntity,
}
if (IsGslPtrValueFromGslTempOwner && DiagLoc.isValid()) {
+ if (SemaRef.currentEvaluationContext().InitCXXForRangeVar)
+ return false;
SemaRef.Diag(DiagLoc, diag::warn_dangling_lifetime_pointer)
<< DiagRange;
return false;
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 923a9e81fbd6..da97d34854ac 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -2374,6 +2374,13 @@ static bool FinishForRangeVarDecl(Sema &SemaRef, VarDecl *Decl, Expr *Init,
SemaRef.ObjC().inferObjCARCLifetime(Decl))
Decl->setInvalidDecl();
+ // EnterExpressionEvaluationContext ForRangeInitContext(
+ // SemaRef, Sema::ExpressionEvaluationContext::PotentiallyEvaluated,
+ // /*LambdaContextDecl=*/nullptr,
+ // Sema::ExpressionEvaluationContextRecord::EK_Other,
+ // SemaRef.getLangOpts().CPlusPlus23);
+ if (SemaRef.getLangOpts().CPlusPlus23)
+ SemaRef.currentEvaluationContext().InitCXXForRangeVar = true;
SemaRef.AddInitializerToDecl(Decl, Init, /*DirectInit=*/false);
SemaRef.FinalizeDeclaration(Decl);
SemaRef.CurContext->addHiddenDecl(Decl);
- Introduce a bitfields into
clang::VarDecl::NonParmVarDeclBitfields, likeCXXForRangeDecl(Eg.CXXForRangeImplicitVar)
CC @cor3ntin
IMO, we have 2 options:
- Add a flag variable into
ExpressionEvaluationContextRecord. Represent that we are initializing the for-range __range variable. Eg.diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 9397546c8fc5..c639a4b4af58 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -6786,6 +6786,9 @@ public: /// Whether we should rebuild CXXDefaultArgExpr and CXXDefaultInitExpr. bool RebuildDefaultArgOrDefaultInit = false; + /// Whether we are initializing a C++ for-range implicit variable '__range'. + bool InitCXXForRangeVar = false; + // When evaluating immediate functions in the initializer of a default // argument or default member initializer, this is the declaration whose // default initializer is being evaluated and the location of the call diff --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp index 060ba3166055..150e27f8acf7 100644 --- a/clang/lib/Sema/CheckExprLifetime.cpp +++ b/clang/lib/Sema/CheckExprLifetime.cpp @@ -1341,6 +1341,8 @@ checkExprLifetimeImpl(Sema &SemaRef, const InitializedEntity *InitEntity, } if (IsGslPtrValueFromGslTempOwner && DiagLoc.isValid()) { + if (SemaRef.currentEvaluationContext().InitCXXForRangeVar) + return false; SemaRef.Diag(DiagLoc, diag::warn_dangling_lifetime_pointer) << DiagRange; return false; diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 923a9e81fbd6..da97d34854ac 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -2374,6 +2374,13 @@ static bool FinishForRangeVarDecl(Sema &SemaRef, VarDecl *Decl, Expr *Init, SemaRef.ObjC().inferObjCARCLifetime(Decl)) Decl->setInvalidDecl(); + // EnterExpressionEvaluationContext ForRangeInitContext( + // SemaRef, Sema::ExpressionEvaluationContext::PotentiallyEvaluated, + // /*LambdaContextDecl=*/nullptr, + // Sema::ExpressionEvaluationContextRecord::EK_Other, + // SemaRef.getLangOpts().CPlusPlus23); + if (SemaRef.getLangOpts().CPlusPlus23) + SemaRef.currentEvaluationContext().InitCXXForRangeVar = true; SemaRef.AddInitializerToDecl(Decl, Init, /*DirectInit=*/false); SemaRef.FinalizeDeclaration(Decl); SemaRef.CurContext->addHiddenDecl(Decl);
- Introduce a bitfields into
clang::VarDecl::NonParmVarDeclBitfields, likeCXXForRangeDecl(Eg.CXXForRangeImplicitVar)CC @cor3ntin
I like option one! Maybe a stupid question, but why can’t we use InLifetimeExtendingContext flag here? It feels like it’s meant to capture the same kind of situation. Is there a subtle difference I’m missing?
I updated (locally) the PR to address the other feedbacks and I will push it to be reviewed when I have the green light to use option 1!
but why can’t we use InLifetimeExtendingContext flag here? Is there a subtle difference I’m missing?
This flag will tiger subroutines to collect MaterializedTemporaryExpr and rebuild default init/arg。 All we need to know here is that ExtendingDecl is a C++ __range var in for-range-loop, so I think we should introduce a new flag in VarDecl. We may need to also modify handling of VarDecl in ASTWriter and ASTReader to ensure that the AST serialization is correct. WDYT?
but why can’t we use InLifetimeExtendingContext flag here? Is there a subtle difference I’m missing?
This flag will tiger subroutines to collect
MaterializedTemporaryExprand rebuild default init/arg。 All we need to know here is thatExtendingDeclis a C++__rangevar in for-range-loop, so I think we should introduce a new flag in VarDecl. We may need to also modify handling of VarDecl in ASTWriter and ASTReader to ensure that the AST serialization is correct. WDYT?
Agreed.
My last commit should implement this. Let me know if something is wrong!
Edit: I pushed again because I messed up with the branches, sorry!
Old clang tidy test failing seems flaky, locally it pass correctly. If it continue to fail I can rebase on upstream.
There are some test failures in the presubmit checks, you probably need to update these tests.
Yes, indeed. For example, in AST/ast-dump-for-range-lifetime.cpp we move from:
-MaterializeTemporaryExpr {{.*}} 'C':'P2718R0::C' xvalue extended by Var {{.*}} '__range1' 'C &&'
to:
-MaterializeTemporaryExpr {{.*}} 'C':'P2718R0::C' xvalue.
At a first look it seems like we are losing info in the AST, but also a couple of line later we got:
-MaterializeTemporaryExpr {{.*}} 'const C':'const P2718R0::C' lvalue extended by Var {{.*}} '__range1' 'C &&'
So it might be fine...
In special/class.temporary/p6.cpp instead is a bit more weird, because it seems we are losing some IR call in case of for-range loops. You can take a look in the logs of the failing test.
Given that I don't know enough about it to say if it is okay or not, I wanted to double check with you. What do you think?
Yes, indeed. For example, in
AST/ast-dump-for-range-lifetime.cppwe move from:-MaterializeTemporaryExpr {{.*}} 'C':'P2718R0::C' xvalue extended by Var {{.*}} '__range1' 'C &&'to:-MaterializeTemporaryExpr {{.*}} 'C':'P2718R0::C' xvalue. At a first look it seems like we are losing info in the AST, but also a couple of line later we got:-MaterializeTemporaryExpr {{.*}} 'const C':'const P2718R0::C' lvalue extended by Var {{.*}} '__range1' 'C &&'So it might be fine...In
special/class.temporary/p6.cppinstead is a bit more weird, because it seems we are losing some IR call in case of for-range loops. You can take a look in the logs of the failing test.Given that I don't know enough about it to say if it is okay or not, I wanted to double check with you. What do you think?
Thanks for looking at them.
It seems this patch is causing some unexpected behavior changes. From what I can tell, this patch only adds a new bit to Decl, which shouldn’t affect the two failing tests. However, I don't spot any obvious cause by reading the patch. Maybe @yronglin has some insights here.
I have debug the issue, seems we cannot move the __range variable check to the start of checkExprLifetimeImpl, we may missing extending lifetime of temporaries.
Eg.
template <typename T>
struct ListWrapper {
ListWrapper() {}
~ListWrapper() {}
const T *begin() const;
const T *end() const;
ListWrapper& r();
ListWrapper g();
};
using A = ListWrapper<int>;
A g() { return A(); }
const A &f1(const A &t) { return t; }
void member_call() {
// CHECK-CXX23: void @_ZN7P2718R011member_call11member_callEv()
// CHECK-CXX23-LABEL: for.cond.cleanup:
// CHECK-CXX23-NEXT: call void @_ZN7P2718R011member_call11ListWrapperIiED1Ev(
// CHECK-CXX23-NEXT: call void @_ZN7P2718R011member_call11ListWrapperIiED1Ev(
// CHECK-CXX23-NEXT: call void @_ZN7P2718R011member_call11ListWrapperIiED1Ev(
// CHECK-CXX23-NEXT: call void @_ZN7P2718R011member_call11ListWrapperIiED1Ev(
for (auto e : g().r().g().r().g().r().g()) {}
}
I think we should revert to the previous approach, what do you think?
if (IsGslPtrValueFromGslTempOwner && DiagLoc.isValid()) {
if (const auto *VD =
dyn_cast_if_present<VarDecl>(ExtendingEntity->getDecl());
SemaRef.getLangOpts().CPlusPlus23 && VD &&
VD->isCXXForRangeImplicitVar())
return true;
SemaRef.Diag(DiagLoc, diag::warn_dangling_lifetime_pointer)
<< DiagRange;
return false;
}
I think we should revert to the previous approach, what do you think?
if (IsGslPtrValueFromGslTempOwner && DiagLoc.isValid()) { if (const auto *VD = dyn_cast_if_present<VarDecl>(ExtendingEntity->getDecl()); SemaRef.getLangOpts().CPlusPlus23 && VD && VD->isCXXForRangeImplicitVar()) return true; SemaRef.Diag(DiagLoc, diag::warn_dangling_lifetime_pointer) << DiagRange; return false; }
Thanks for debugging that! I agree btw, didn't think about this side effect before.
Forgot that the revert wouldn't include the lifetimebound attribute. I restructured the switch case like that, in order to catch both:
case LK_Extended: {
if (!MTE) {
// The initialized entity has lifetime beyond the full-expression,
// and the local entity does too, so don't warn.
//
// FIXME: We should consider warning if a static / thread storage
// duration variable retains an automatic storage duration local.
return false;
}
switch (shouldLifetimeExtendThroughPath(Path)) {
case PathLifetimeKind::Extend:
assert(!IsGslPtrValueFromGslTempOwner); // Just a test, to be sure that we aren't losing something here.
// can be removed safely I guess.
// Update the storage duration of the materialized temporary.
// FIXME: Rebuild the expression instead of mutating it.
MTE->setExtendingDecl(ExtendingEntity->getDecl(),
ExtendingEntity->allocateManglingNumber());
// Also visit the temporaries lifetime-extended by this initializer.
return true;
case PathLifetimeKind::NoExtend:
if (SemaRef.getLangOpts().CPlusPlus23 && InitEntity) {
if (const VarDecl *VD =
dyn_cast_if_present<VarDecl>(InitEntity->getDecl());
VD && VD->isCXXForRangeImplicitVar())
return false;
}
if (IsGslPtrValueFromGslTempOwner && DiagLoc.isValid()) {
SemaRef.Diag(DiagLoc, diag::warn_dangling_lifetime_pointer)
<< DiagRange;
return false;
}
// If the path goes through the initialization of a variable or field,
// it can't possibly reach a temporary created in this full-expression.
// We will have already diagnosed any problems with the initializer.
if (pathContainsInit(Path))
return false;
SemaRef.Diag(DiagLoc, diag::warn_dangling_variable)
<< RK << !InitEntity->getParent()
<< ExtendingEntity->getDecl()->isImplicit()
<< ExtendingEntity->getDecl() << Init->isGLValue() << DiagRange;
break;
}
break;
}
Forgot that the revert wouldn't include the
lifetimeboundattribute. I restructured the switch case like that, in order to catch both:case LK_Extended: { if (!MTE) { // The initialized entity has lifetime beyond the full-expression, // and the local entity does too, so don't warn. // // FIXME: We should consider warning if a static / thread storage // duration variable retains an automatic storage duration local. return false; } switch (shouldLifetimeExtendThroughPath(Path)) { case PathLifetimeKind::Extend: assert(!IsGslPtrValueFromGslTempOwner); // Just a test, to be sure that we aren't losing something here. // can be removed safely I guess. // Update the storage duration of the materialized temporary. // FIXME: Rebuild the expression instead of mutating it. MTE->setExtendingDecl(ExtendingEntity->getDecl(), ExtendingEntity->allocateManglingNumber()); // Also visit the temporaries lifetime-extended by this initializer. return true; case PathLifetimeKind::NoExtend: if (SemaRef.getLangOpts().CPlusPlus23 && InitEntity) { if (const VarDecl *VD = dyn_cast_if_present<VarDecl>(InitEntity->getDecl()); VD && VD->isCXXForRangeImplicitVar()) return false; } if (IsGslPtrValueFromGslTempOwner && DiagLoc.isValid()) { SemaRef.Diag(DiagLoc, diag::warn_dangling_lifetime_pointer) << DiagRange; return false; } // If the path goes through the initialization of a variable or field, // it can't possibly reach a temporary created in this full-expression. // We will have already diagnosed any problems with the initializer. if (pathContainsInit(Path)) return false; SemaRef.Diag(DiagLoc, diag::warn_dangling_variable) << RK << !InitEntity->getParent() << ExtendingEntity->getDecl()->isImplicit() << ExtendingEntity->getDecl() << Init->isGLValue() << DiagRange; break; } break; }
Could you push the changes to this PR?
I have debug the issue, seems we cannot move the __range variable check to the start of checkExprLifetimeImpl, we may missing extending lifetime of temporaries.
Ah, that makes sense -- I missed the fact that this part of the code is also responsible for extending the object’s lifetime. Thanks a lot for looking into this and clarifying it.
Do you need the help to merge this PR?
Do you need the help to merge this PR?
Yes please, also not sure if I can merge being my first PR. Also should we wait on the third review? Not sure about the reviews policies!
@mrcvtl Congratulations on having your first Pull Request (PR) merged into the LLVM Project!
Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.
Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.
How to do this, and the rest of the post-merge process, is covered in detail here.
If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.
If you don't get any reports, no action is required from you. Your changes are working as expected, well done!
Congratulations, the first LLVM PR has landed!
LLVM Buildbot has detected a new failure on builder sanitizer-aarch64-linux running on sanitizer-buildbot7 while building clang at step 2 "annotate".
Full details are available at: https://lab.llvm.org/buildbot/#/builders/51/builds/19520
Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:73: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 5764 tests, 72 workers --
Testing: 0.. 10..
FAIL: AddressSanitizer-aarch64-linux-dynamic :: TestCases/Posix/halt_on_error-signals.c (1199 of 5764)
******************** TEST 'AddressSanitizer-aarch64-linux-dynamic :: TestCases/Posix/halt_on_error-signals.c' FAILED ********************
Exit Code: 1
Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -nobuiltininc -I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include -idirafter /home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include -resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build -Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux -shared-libasan -fsanitize-recover=address -pthread /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c -o /home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp # RUN: at line 3
+ /home/b/sanitizer-aarch64-linux/build/build_default/bin/clang -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -nobuiltininc -I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include -idirafter /home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include -resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build -Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux -shared-libasan -fsanitize-recover=address -pthread /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c -o /home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp
In file included from /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c:11:
In file included from /usr/aarch64-linux-gnu/include/stdio.h:28:
In file included from /usr/aarch64-linux-gnu/include/bits/libc-header-start.h:33:
/usr/aarch64-linux-gnu/include/features.h:196:3: warning: "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-W#warnings]
196 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
| ^
1 warning generated.
env ASAN_OPTIONS=halt_on_error=false:suppress_equal_pcs=false /home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp 100 >/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp.log 2>&1 || true # RUN: at line 5
+ env ASAN_OPTIONS=halt_on_error=false:suppress_equal_pcs=false /home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp 100
+ true
FileCheck --check-prefix=CHECK-COLLISION /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c </home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp.log || FileCheck --check-prefix=CHECK-NO-COLLISION /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c </home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp.log # RUN: at line 7
+ FileCheck --check-prefix=CHECK-COLLISION /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c
/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c:29:22: error: CHECK-COLLISION: expected string not found in input
// CHECK-COLLISION: AddressSanitizer: nested bug in the same thread, aborting
^
<stdin>:1:1: note: scanning from here
=================================================================
^
<stdin>:13:10: note: possible intended match here
SUMMARY: AddressSanitizer: use-after-poison /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c:32:12 in error
^
Input file: <stdin>
Check file: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: =================================================================
check:29'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
Step 16 (test standalone compiler-rt) failure: test standalone compiler-rt (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:60: warning: Path reported by clang does not exist: "/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/aarch64-unknown-linux-gnu". This path was found by running ['/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang', '--target=aarch64-unknown-linux-gnu', '-Wthread-safety', '-Wthread-safety-reference', '-Wthread-safety-beta', '-nobuiltininc', '-I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include', '-idirafter', '/home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include', '-resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build', '-Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux', '-print-runtime-dir'].
llvm-lit: /home/b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:73: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 5764 tests, 72 workers --
Testing: 0.. 10..
FAIL: AddressSanitizer-aarch64-linux-dynamic :: TestCases/Posix/halt_on_error-signals.c (1199 of 5764)
******************** TEST 'AddressSanitizer-aarch64-linux-dynamic :: TestCases/Posix/halt_on_error-signals.c' FAILED ********************
Exit Code: 1
Command Output (stderr):
--
/home/b/sanitizer-aarch64-linux/build/build_default/bin/clang -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -nobuiltininc -I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include -idirafter /home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include -resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build -Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux -shared-libasan -fsanitize-recover=address -pthread /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c -o /home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp # RUN: at line 3
+ /home/b/sanitizer-aarch64-linux/build/build_default/bin/clang -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -nobuiltininc -I/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/include -idirafter /home/b/sanitizer-aarch64-linux/build/build_default/lib/clang/21/include -resource-dir=/home/b/sanitizer-aarch64-linux/build/compiler_rt_build -Wl,-rpath,/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/lib/linux -shared-libasan -fsanitize-recover=address -pthread /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c -o /home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp
In file included from /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c:11:
In file included from /usr/aarch64-linux-gnu/include/stdio.h:28:
In file included from /usr/aarch64-linux-gnu/include/bits/libc-header-start.h:33:
/usr/aarch64-linux-gnu/include/features.h:196:3: warning: "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-W#warnings]
196 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
| ^
1 warning generated.
env ASAN_OPTIONS=halt_on_error=false:suppress_equal_pcs=false /home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp 100 >/home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp.log 2>&1 || true # RUN: at line 5
+ env ASAN_OPTIONS=halt_on_error=false:suppress_equal_pcs=false /home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp 100
+ true
FileCheck --check-prefix=CHECK-COLLISION /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c </home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp.log || FileCheck --check-prefix=CHECK-NO-COLLISION /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c </home/b/sanitizer-aarch64-linux/build/compiler_rt_build/test/asan/AARCH64LinuxDynamicConfig/TestCases/Posix/Output/halt_on_error-signals.c.tmp.log # RUN: at line 7
+ FileCheck --check-prefix=CHECK-COLLISION /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c
/home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c:29:22: error: CHECK-COLLISION: expected string not found in input
// CHECK-COLLISION: AddressSanitizer: nested bug in the same thread, aborting
^
<stdin>:1:1: note: scanning from here
=================================================================
^
<stdin>:13:10: note: possible intended match here
SUMMARY: AddressSanitizer: use-after-poison /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c:32:12 in error
^
Input file: <stdin>
Check file: /home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/asan/TestCases/Posix/halt_on_error-signals.c
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: =================================================================
check:29'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
LLVM Buildbot has detected a new failure on builder
sanitizer-aarch64-linuxrunning onsanitizer-buildbot7while buildingclangat step 2 "annotate".Full details are available at: https://lab.llvm.org/buildbot/#/builders/51/builds/19520
Here is the relevant piece of the build log for the reference
This failure seem not caused by this PR.