Skip to content

[analyzer] Model overflow builtins #102602

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

Merged
merged 13 commits into from
Oct 3, 2024
Merged

[analyzer] Model overflow builtins #102602

merged 13 commits into from
Oct 3, 2024

Conversation

pskrgag
Copy link
Contributor

@pskrgag pskrgag commented Aug 9, 2024

Add basic support for builtin_*_overflow primitives.

These helps a lot for checking custom calloc-like functions with inlinable body. Without such support code like

#include <stddef.h>
#include <stdlib.h>

static void *myMalloc(size_t a1, size_t a2)
{
    size_t res;

    if (__builtin_mul_overflow(a1, a2, &res))
        return NULL;
    return malloc(res);
}

void test(void)
{
    char *ptr = myMalloc(10, 1);
    ptr[20] = 10;
}

does not trigger any warnings.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:static analyzer labels Aug 9, 2024
@pskrgag pskrgag changed the title clang/csa: add initial support for builtin overflow [clang] [Static analyzer]: add initial support for builtin overflow Aug 9, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 9, 2024

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Pavel Skripkin (pskrgag)

Changes

Add basic support for builtin_*_overflow primitives.

These helps a lot for checking custom calloc-like functions with inlinable body. Without such support code like

#include &lt;stddef.h&gt;
#include &lt;stdlib.h&gt;

static void *myMalloc(size_t a1, size_t a2)
{
    size_t res;

    if (__builtin_smul_overflow(a1, a2, &amp;res))
        return NULL;
    return malloc(res);
}

void test(void)
{
    char *ptr = myMalloc(10, 1);
    ptr[20] = 10;
}

does not trigger any warnings.


Full diff: https://github.com/llvm/llvm-project/pull/102602.diff

3 Files Affected:

  • (modified) clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp (+122-2)
  • (added) clang/test/Analysis/builtin_overflow.c (+65)
  • (modified) clang/test/Analysis/out-of-bounds-diagnostics.c (+17)
diff --git a/clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
index b198b1c2ff4d11..0c8b9fa3d947b0 100644
--- a/clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
@@ -21,16 +21,67 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/DynamicExtent.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 
 using namespace clang;
 using namespace ento;
 
 namespace {
 
+QualType getOverflowBuiltinResultType(const CallEvent &Call) {
+  assert(Call.getNumArgs() == 3);
+
+  return Call.getArgExpr(2)->getType()->getPointeeType();
+}
+
+QualType getOverflowBuiltinResultType(const CallEvent &Call, CheckerContext &C,
+                                      unsigned BI) {
+  assert(Call.getNumArgs() == 3);
+
+  ASTContext &Ast = C.getASTContext();
+
+  switch (BI) {
+  case Builtin::BI__builtin_smul_overflow:
+  case Builtin::BI__builtin_ssub_overflow:
+  case Builtin::BI__builtin_sadd_overflow:
+    return Ast.IntTy;
+  case Builtin::BI__builtin_smull_overflow:
+  case Builtin::BI__builtin_ssubl_overflow:
+  case Builtin::BI__builtin_saddl_overflow:
+    return Ast.LongTy;
+  case Builtin::BI__builtin_smulll_overflow:
+  case Builtin::BI__builtin_ssubll_overflow:
+  case Builtin::BI__builtin_saddll_overflow:
+    return Ast.LongLongTy;
+  case Builtin::BI__builtin_umul_overflow:
+  case Builtin::BI__builtin_usub_overflow:
+  case Builtin::BI__builtin_uadd_overflow:
+    return Ast.UnsignedIntTy;
+  case Builtin::BI__builtin_umull_overflow:
+  case Builtin::BI__builtin_usubl_overflow:
+  case Builtin::BI__builtin_uaddl_overflow:
+    return Ast.UnsignedLongTy;
+  case Builtin::BI__builtin_umulll_overflow:
+  case Builtin::BI__builtin_usubll_overflow:
+  case Builtin::BI__builtin_uaddll_overflow:
+    return Ast.UnsignedLongLongTy;
+  case Builtin::BI__builtin_mul_overflow:
+  case Builtin::BI__builtin_sub_overflow:
+  case Builtin::BI__builtin_add_overflow:
+    return getOverflowBuiltinResultType(Call);
+  default:
+    assert(false && "Unknown overflow builtin");
+  }
+}
+
 class BuiltinFunctionChecker : public Checker<eval::Call> {
 public:
   bool evalCall(const CallEvent &Call, CheckerContext &C) const;
+  void HandleOverflowBuiltin(const CallEvent &Call, CheckerContext &C,
+                             BinaryOperator::Opcode Op,
+                             QualType ResultType) const;
 
 private:
   // From: clang/include/clang/Basic/Builtins.def
@@ -50,6 +101,44 @@ class BuiltinFunctionChecker : public Checker<eval::Call> {
 
 } // namespace
 
+void BuiltinFunctionChecker::HandleOverflowBuiltin(const CallEvent &Call,
+                                                   CheckerContext &C,
+                                                   BinaryOperator::Opcode Op,
+                                                   QualType ResultType) const {
+  // All __builtin_*_overflow functions take 3 argumets.
+  assert(Call.getNumArgs() == 3);
+
+  ProgramStateRef State = C.getState();
+  SValBuilder &SVB = C.getSValBuilder();
+  const Expr *CE = Call.getOriginExpr();
+
+  SVal Arg1 = Call.getArgSVal(0);
+  SVal Arg2 = Call.getArgSVal(1);
+
+  SVal RetVal = SVB.evalBinOp(State, Op, Arg1, Arg2, ResultType);
+
+  // TODO: Handle overflows with values that known to overflow. Like INT_MAX + 1
+  // should not produce state for non-overflow case and threat it as
+  // unreachable.
+
+  // Handle non-overflow case.
+  {
+    ProgramStateRef StateSuccess =
+        State->BindExpr(CE, C.getLocationContext(), SVB.makeTruthVal(false));
+
+    if (auto L = Call.getArgSVal(2).getAs<Loc>())
+      StateSuccess = StateSuccess->bindLoc(*L, RetVal, C.getLocationContext());
+
+    C.addTransition(StateSuccess);
+  }
+
+  // Handle overflow case.
+  {
+    C.addTransition(
+        State->BindExpr(CE, C.getLocationContext(), SVB.makeTruthVal(true)));
+  }
+}
+
 bool BuiltinFunctionChecker::isBuiltinLikeFunction(
     const CallEvent &Call) const {
   const auto *FD = llvm::dyn_cast_or_null<FunctionDecl>(Call.getDecl());
@@ -82,10 +171,41 @@ bool BuiltinFunctionChecker::evalCall(const CallEvent &Call,
     return true;
   }
 
-  switch (FD->getBuiltinID()) {
+  unsigned BI = FD->getBuiltinID();
+
+  switch (BI) {
   default:
     return false;
-
+  case Builtin::BI__builtin_mul_overflow:
+  case Builtin::BI__builtin_smul_overflow:
+  case Builtin::BI__builtin_smull_overflow:
+  case Builtin::BI__builtin_smulll_overflow:
+  case Builtin::BI__builtin_umul_overflow:
+  case Builtin::BI__builtin_umull_overflow:
+  case Builtin::BI__builtin_umulll_overflow:
+    HandleOverflowBuiltin(Call, C, BO_Mul,
+                          getOverflowBuiltinResultType(Call, C, BI));
+    return true;
+  case Builtin::BI__builtin_sub_overflow:
+  case Builtin::BI__builtin_ssub_overflow:
+  case Builtin::BI__builtin_ssubl_overflow:
+  case Builtin::BI__builtin_ssubll_overflow:
+  case Builtin::BI__builtin_usub_overflow:
+  case Builtin::BI__builtin_usubl_overflow:
+  case Builtin::BI__builtin_usubll_overflow:
+    HandleOverflowBuiltin(Call, C, BO_Sub,
+                          getOverflowBuiltinResultType(Call, C, BI));
+    return true;
+  case Builtin::BI__builtin_add_overflow:
+  case Builtin::BI__builtin_sadd_overflow:
+  case Builtin::BI__builtin_saddl_overflow:
+  case Builtin::BI__builtin_saddll_overflow:
+  case Builtin::BI__builtin_uadd_overflow:
+  case Builtin::BI__builtin_uaddl_overflow:
+  case Builtin::BI__builtin_uaddll_overflow:
+    HandleOverflowBuiltin(Call, C, BO_Add,
+                          getOverflowBuiltinResultType(Call, C, BI));
+    return true;
   case Builtin::BI__builtin_assume:
   case Builtin::BI__assume: {
     assert (Call.getNumArgs() > 0);
diff --git a/clang/test/Analysis/builtin_overflow.c b/clang/test/Analysis/builtin_overflow.c
new file mode 100644
index 00000000000000..3b8639aa450046
--- /dev/null
+++ b/clang/test/Analysis/builtin_overflow.c
@@ -0,0 +1,65 @@
+// RUN: %clang_analyze_cc1 -triple x86_64-unknown-unknown -verify %s \
+// RUN:   -analyzer-checker=core,debug.ExprInspection
+
+#define NULL ((void *)0)
+#define INT_MAX __INT_MAX__
+
+void clang_analyzer_dump_int(int);
+
+void test1(void)
+{
+   int res;
+
+   if (__builtin_add_overflow(10, 20, &res)) {
+     clang_analyzer_dump_int(res); //expected-warning{{1st function call argument is an uninitialized value}}
+     return;
+   }
+
+   clang_analyzer_dump_int(res); //expected-warning{{30}}
+}
+
+void test2(void)
+{
+   int res;
+
+   __builtin_add_overflow(10, 20, &res);
+   clang_analyzer_dump_int(res); //expected-warning{{1st function call argument is an uninitialized value}} expected-warning{{S32b}}
+}
+
+void test3(void)
+{
+   int res;
+
+   if (__builtin_sub_overflow(10, 20, &res)) {
+     clang_analyzer_dump_int(res); //expected-warning{{1st function call argument is an uninitialized value}}
+     return;
+   }
+
+   clang_analyzer_dump_int(res); //expected-warning{{-10}}
+}
+
+void test4(void)
+{
+   int res;
+
+   if (__builtin_sub_overflow(10, 20, &res)) {
+     clang_analyzer_dump_int(res); //expected-warning{{1st function call argument is an uninitialized value}}
+     return;
+   }
+
+   if (res != -10) {
+     *(volatile char *)NULL; //no warning
+   }
+}
+
+void test5(void)
+{
+   int res;
+
+   if (__builtin_mul_overflow(10, 20, &res)) {
+     clang_analyzer_dump_int(res); //expected-warning{{1st function call argument is an uninitialized value}}
+     return;
+   }
+
+   clang_analyzer_dump_int(res); //expected-warning{{200}}
+}
diff --git a/clang/test/Analysis/out-of-bounds-diagnostics.c b/clang/test/Analysis/out-of-bounds-diagnostics.c
index de70e483add1c0..73b56e7a8ba4db 100644
--- a/clang/test/Analysis/out-of-bounds-diagnostics.c
+++ b/clang/test/Analysis/out-of-bounds-diagnostics.c
@@ -278,6 +278,23 @@ int *mallocRegion(void) {
   return mem;
 }
 
+int *custom_calloc(size_t a, size_t b) {
+  size_t res;
+  if (__builtin_mul_overflow(a, b, &res))
+    return 0;
+
+  return malloc(res);
+}
+
+int *mallocRegionOverflow(void) {
+  int *mem = (int*)custom_calloc(4, 10);
+
+  mem[20] = 10;
+  // expected-warning@-1 {{Out of bound access to memory after the end of the heap area}}
+  // expected-note@-2 {{Access of the heap area at index 20, while it holds only 10 'int' elements}}
+  return mem;
+}
+
 int *mallocRegionDeref(void) {
   int *mem = (int*)malloc(2*sizeof(int));
 

SVal RetVal = SVB.evalBinOp(State, Op, Arg1, Arg2, ResultType);

// TODO: Handle overflows with values that known to overflow. Like INT_MAX + 1
// should not produce state for non-overflow case and threat it as
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find a way to check this. We could do old-style thing like res < 0 ? lhs > rhs : lhs < rhs , but I guess, SVB should take care of it?

Copy link
Contributor

@NagyDonat NagyDonat Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this for some time and checked the implementation of evalBinOp (more precisely SValBuilder:evalBinOpNN, the case that's relevant here), but unfortunately I don't see a clear solution.

You are right that SVB should take care of this, but unfortunately that does not happen currently.

Currently the analyzer (and SValBuilder in particular) has its own rigid opinion about overflow handling: it allows overflow on all numeric operations (including signed ones, where it's undefined behavior according to the standard) and models it without splitting the state, so e.g. if x and y are signed char values within the range 50 <= x, y <= 100, then it calculates that the possible values of x+y are $[-128, -56] \cup [100, 127]$.

It would be good to enhance this behavior by tagging the ranges within the RangeSet with "did overflow happen?" bits that would let us perform a state split. This is theoretically doable (I don't see anything that would block this), but would be a complex refactoring effort (we'd need to pass along this "did we overflow?" bit through all the spaghetti code).

Without this refactoring, you can implement a workaround that calls SValBuilder::getMinValue() and SValBuilder::getMaxValue() to get the minimal and maximal values of the operands (as llvm::APSInt values, that is, arbitrary precision signed integers) and then uses these to determine which of the two branches (overflow, no-overflow) are possible.

This workaround solution would be significantly better than the current "always act as if both branches were possible", but it is not sufficient for deducing the set of possible results on the no-overflow branch. (That is, if x and y are signed char values within the range 50 <= x, y <= 100, then this workaround would create two branches: one where __builtin_add_overflow returns true, and and one where it returns false and stores a symbol with range $[-128, -56] \cup [100, 127]$ within the result pointer; while the correct assumption would be that the result has range $[100, 127]$ on this no-overflow branch.)

(I know that this is a very complicated area, feel free to ask me if you need help with it!)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

evalBinOp models wrapping semantics - even for signed arithmetic (where it would be UB).
We don't have a similar evaluation model (operating on symbolic values, aka. SVals) which operates with mathematical (non-wrapping) semantics. This is unfortunate.

Initially I wanted to recommend SVB.getKnownValue(State, Val), but I believe it's not too likely that one would use malloc with two concrete int params. So this wouldn't really enable many use-cases.

I can agree with @NagyDonat, about using getMinValue and friends. That would enable us using the constraints we have in the State, and unlock symbolic cases.

Copy link
Contributor Author

@pskrgag pskrgag Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So.... I've pushed what I came up with for handling overflow, but during test writing I found smth I don't understand. I've decided to push current state, since it's easier to show code than describe it =)

My current problem is following code:

   if (a > 10)
     return;
   if (b > 10)
     return;

   // clang_analyzer_eval(a + b < 30); <--- Prints 1 and 0, but why ???

For some reason constraints do not work as expected. And because of that my overflow checker splits state where it shouldn't.... I'd really appreciate tips

My approach to check is to promote result type to x2 width, perform operation on it and then check if it overflows real result type. I've done 2 evalBinOp, since I didn't find a way to cast between 2 results.

Copy link
Contributor

@NagyDonat NagyDonat Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang_analyzer_eval(a + b < 30); <--- Prints 1 and 0, but why ???

Assuming that a and b are signed integers, they can be very negative, and then their sum can be a positive value above 30 (after an underflow). This means that both boolean values are possible for the expression a + b < 30, and the analyzer represents this by printing both 1 and 0.

(If I understand this correctly, we get two definite numbers instead of one range because the on-by-default eagerlyAssume mode causes a state split when it sees the comparison operator in a + b < 30, despite the fact that this is not in a conditional expression.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming that a and b are signed integers

Oh, sorry, I forgot to mention that a and b are unsigned. I've showed this in test_uadd_overflow_contraints test in this pr

Copy link
Contributor

@NagyDonat NagyDonat Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some digging in RangedConstraintManager and it seems that algebraic expressions that involve two symbolic values are handled as black boxes by the analyzer: in your example it creates a SymSymExpr that is known to be the sum of a and b, but we don't have any logic which would constrain the potential values of this SymSymExpr based on the constraints known about the operands. (The analyzer can propagate information in the easier case when it knows the exact value of one of the operands.)

I don't know why do we have this shameful limitation... I'd guess that implementing the necessary RangeSet operation wouldn't be prohibitively difficult, but there may be performance implications, and perhaps well-constrained (but not exactly known) values are not common enough to make this a valuable investment.

(It's also possible that we do have this logic, but it's tucked away somewhere else where I didn't find it; although your experimental results show that this is unlikely.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the ConstraintAssignor does the decomposition of the SymSymExpr and tracks the potential value range. It's probably somewhat limited though.

Copy link
Contributor

@NagyDonat NagyDonat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding support for these functions! The code LGTM overall, except for one mostly theoretical issue (about the use of assert) which I described in an inline comment.

@NagyDonat NagyDonat requested a review from steakhal August 9, 2024 13:41
Copy link
Contributor

@steakhal steakhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good!

However, for this to land, we need to try harder to prevent state-splits.
We must prove in more cases (at least in simple symbolic cases) that no overflow can happen.

But in principle, I like that we do a split - as the user expects this to overflow sometimes - given the use of the builtin.

Speaking of that, do we even propagate taint across such builtin calls? I think it would make sense to taint the result if any of the inputs are tainted. I'd expect such builtins used around user inputs, and critical code - so probably it worth propagating taint.

SVal RetVal = SVB.evalBinOp(State, Op, Arg1, Arg2, ResultType);

// TODO: Handle overflows with values that known to overflow. Like INT_MAX + 1
// should not produce state for non-overflow case and threat it as
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

evalBinOp models wrapping semantics - even for signed arithmetic (where it would be UB).
We don't have a similar evaluation model (operating on symbolic values, aka. SVals) which operates with mathematical (non-wrapping) semantics. This is unfortunate.

Initially I wanted to recommend SVB.getKnownValue(State, Val), but I believe it's not too likely that one would use malloc with two concrete int params. So this wouldn't really enable many use-cases.

I can agree with @NagyDonat, about using getMinValue and friends. That would enable us using the constraints we have in the State, and unlock symbolic cases.

@steakhal steakhal changed the title [clang] [Static analyzer]: add initial support for builtin overflow [analyzer] Model overflow builtins Aug 9, 2024
Copy link

github-actions bot commented Aug 11, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@steakhal
Copy link
Contributor

Try using the Github merge workflow to avoid doing force-pushes. Those are destructive for inline comments done for the PR. On force-push, GH can't follow to which line it should migrate the existing inline comments, thus drops them.

You should just do a fetch main, merge main, push branch (without force).

@pskrgag
Copy link
Contributor Author

pskrgag commented Aug 13, 2024

Try using the Github merge workflow to avoid doing force-pushes. Those are destructive for inline comments done for the PR. On force-push, GH can't follow to which line it should migrate the existing inline comments, thus drops them.

Sorry again for fp =(. I am getting used to rebase+fp workflow, since I've never worked with gh flow. I am trying to switch my brain while developing llvm, but sometimes I mess up.

@pskrgag
Copy link
Contributor Author

pskrgag commented Aug 16, 2024

Could you, please, check the lattest vestion, if you have time?

@steakhal
Copy link
Contributor

I'm on vacation for some time now.
Maybe others can chim in. Should I ping someone?

@pskrgag
Copy link
Contributor Author

pskrgag commented Aug 16, 2024

Oh, sorry for ping then. PR is not urgent at all.

Have a fun vacation! =)

@pskrgag
Copy link
Contributor Author

pskrgag commented Aug 31, 2024

gentle ping

Copy link
Contributor

@steakhal steakhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good. I only had some notes w.r.t. note tags.


if (a != 10)
return;
if (b != 10)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such constraints we call "perfect constraints" as they narrow down the value domain to a single value. After this, the engine will fold all uses of this into a concreteInt, eliminating the symbolic value.

Consequently, perfect constraints are different to common constraints. They should have separate tests.

That said, two symbolic values with half side constraints are missing. x>=(int max -2, y>= 10 for instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to add smth like this, but it fails even for more simple constraint like if (a > 10 || b > 10) return; for unsigned case. See #102602 (comment).

@pskrgag
Copy link
Contributor Author

pskrgag commented Sep 11, 2024

Hello!

Is there anything else that stops this PR? Thanks!

Copy link
Contributor

@NagyDonat NagyDonat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-reviewed the commit and added two very minor remarks, otherwise LGTM.

@pskrgag
Copy link
Contributor Author

pskrgag commented Sep 28, 2024

gentle ping

Copy link
Contributor

@steakhal steakhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fantastic! I have no functional remarks. I only sprinkled it with some nits, but other than those it's perfect.
It's already good, I'll let you decide if you want to do the final touches or not as those may be more subjective suggestions.

SVal RetVal = SVB.evalBinOp(State, Op, Arg1, Arg2, ResultType);

// TODO: Handle overflows with values that known to overflow. Like INT_MAX + 1
// should not produce state for non-overflow case and threat it as
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the ConstraintAssignor does the decomposition of the SymSymExpr and tracks the potential value range. It's probably somewhat limited though.

{
int res;

if (__builtin_add_overflow(a, b, &res)) // expected-note {{Assuming overflow does not happen}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's just me, but I find this phrasing a bit weird.
To me it would read a lot more natural if it was Assuming overflow or Assuming no overflow. Maybe suffixed with ... happens.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the phrasing suggested by @steakhal would be better, but I think that the original is also acceptable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed wording. I definitely like your suggestion

Copy link
Contributor

@NagyDonat NagyDonat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also LGTM, sorry for not responding earlier. I agree with the minor suggestions of @steakhal .

Copy link
Contributor

@steakhal steakhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still LGTM

@pskrgag
Copy link
Contributor Author

pskrgag commented Oct 2, 2024

Ah, this dangling reference to rvalue... I do remember why I bind get{Min, Max}Value to locals -- ConcreteInt takes a reference to APSInt, so it's not possible to pass result of these calls directly to constructor.

@steakhal steakhal merged commit a017ed0 into llvm:main Oct 3, 2024
9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2024

LLVM Buildbot has detected a new failure on builder fuchsia-x86_64-linux running on fuchsia-debian-64-us-central1-a-1 while building clang at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/11/builds/6049

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/fuchsia-linux.py ...' (failure)
...
[666/1327] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/EnumeratedArrayTest.cpp.o
clang++: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
[667/1327] Linking CXX executable bin/yaml2obj
[667/1327] Running lld test suite
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/ld.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/lld-link
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/ld64.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/wasm-ld
-- Testing: 2990 tests, 60 workers --
Testing:  0.. 10.. 20
FAIL: lld :: ELF/basic-block-sections-pc32reloc.s (702 of 2990)
******************** TEST 'lld :: ELF/basic-block-sections-pc32reloc.s' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 7: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/llvm-mc -filetype=obj -triple=x86_64 /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/ELF/basic-block-sections-pc32reloc.s -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/tools/lld/test/ELF/Output/basic-block-sections-pc32reloc.s.tmp.o
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/llvm-mc -filetype=obj -triple=x86_64 /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/ELF/basic-block-sections-pc32reloc.s -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/tools/lld/test/ELF/Output/basic-block-sections-pc32reloc.s.tmp.o
RUN: at line 8: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/llvm-objdump -dr /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/tools/lld/test/ELF/Output/basic-block-sections-pc32reloc.s.tmp.o| /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/ELF/basic-block-sections-pc32reloc.s --check-prefix=RELOC
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/llvm-objdump -dr /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/tools/lld/test/ELF/Output/basic-block-sections-pc32reloc.s.tmp.o
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/ELF/basic-block-sections-pc32reloc.s --check-prefix=RELOC
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/ELF/basic-block-sections-pc32reloc.s:13:15: error: RELOC-NEXT: is not on the line after the previous match
# RELOC-NEXT: R_X86_64_PC32
              ^
<stdin>:11:20: note: 'next' match was here
 000000000000000a: R_X86_64_PC32 .text-0x1
                   ^
<stdin>:2:63: note: previous match ended here
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/tools/lld/test/ELF/Output/basic-block-sections-pc32reloc.s.tmp.o: file format elf64-x86-64
                                                              ^
<stdin>:3:1: note: non-matching line after previous match is here

^

Input file: <stdin>
Check file: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/ELF/basic-block-sections-pc32reloc.s

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
         6: 0000000000000000 <foo>: 
         7:  0: 0f 1f 00 nopl (%rax) 
         8:  3: 0f 84 00 00 00 00 je 0x9 <foo+0x9> 
         9:  0000000000000005: R_X86_64_PLT32 .text-0x4 
        10:  9: e9 00 00 00 00 jmp 0xe <foo+0xe> 
Step 7 (check) failure: check (failure)
...
[666/1327] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/EnumeratedArrayTest.cpp.o
clang++: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
[667/1327] Linking CXX executable bin/yaml2obj
[667/1327] Running lld test suite
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/ld.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/lld-link
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/ld64.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/wasm-ld
-- Testing: 2990 tests, 60 workers --
Testing:  0.. 10.. 20
FAIL: lld :: ELF/basic-block-sections-pc32reloc.s (702 of 2990)
******************** TEST 'lld :: ELF/basic-block-sections-pc32reloc.s' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 7: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/llvm-mc -filetype=obj -triple=x86_64 /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/ELF/basic-block-sections-pc32reloc.s -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/tools/lld/test/ELF/Output/basic-block-sections-pc32reloc.s.tmp.o
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/llvm-mc -filetype=obj -triple=x86_64 /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/ELF/basic-block-sections-pc32reloc.s -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/tools/lld/test/ELF/Output/basic-block-sections-pc32reloc.s.tmp.o
RUN: at line 8: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/llvm-objdump -dr /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/tools/lld/test/ELF/Output/basic-block-sections-pc32reloc.s.tmp.o| /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/ELF/basic-block-sections-pc32reloc.s --check-prefix=RELOC
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/llvm-objdump -dr /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/tools/lld/test/ELF/Output/basic-block-sections-pc32reloc.s.tmp.o
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/ELF/basic-block-sections-pc32reloc.s --check-prefix=RELOC
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/ELF/basic-block-sections-pc32reloc.s:13:15: error: RELOC-NEXT: is not on the line after the previous match
# RELOC-NEXT: R_X86_64_PC32
              ^
<stdin>:11:20: note: 'next' match was here
 000000000000000a: R_X86_64_PC32 .text-0x1
                   ^
<stdin>:2:63: note: previous match ended here
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-8ttjmpeb/tools/lld/test/ELF/Output/basic-block-sections-pc32reloc.s.tmp.o: file format elf64-x86-64
                                                              ^
<stdin>:3:1: note: non-matching line after previous match is here

^

Input file: <stdin>
Check file: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/lld/test/ELF/basic-block-sections-pc32reloc.s

-dump-input=help explains the following input dump.

Input was:
<<<<<<
         .
         .
         .
         6: 0000000000000000 <foo>: 
         7:  0: 0f 1f 00 nopl (%rax) 
         8:  3: 0f 84 00 00 00 00 je 0x9 <foo+0x9> 
         9:  0000000000000005: R_X86_64_PLT32 .text-0x4 
        10:  9: e9 00 00 00 00 jmp 0xe <foo+0xe> 

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2024

LLVM Buildbot has detected a new failure on builder lldb-arm-ubuntu running on linaro-lldb-arm-ubuntu while building clang at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/18/builds/4864

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: lang/cpp/incomplete-types/TestCppIncompleteTypes.py (794 of 2814)
PASS: lldb-api :: lang/cpp/incomplete-types/members/TestCppIncompleteTypeMembers.py (795 of 2814)
PASS: lldb-api :: lang/cpp/keywords_enabled/TestCppKeywordsEnabled.py (796 of 2814)
PASS: lldb-api :: lang/cpp/inlines/TestInlines.py (797 of 2814)
PASS: lldb-api :: lang/cpp/lambdas/TestLambdas.py (798 of 2814)
PASS: lldb-api :: lang/cpp/llvm-style/TestLLVMStyle.py (799 of 2814)
PASS: lldb-api :: lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py (800 of 2814)
UNSUPPORTED: lldb-api :: lang/cpp/modules-import/TestCXXModulesImport.py (801 of 2814)
PASS: lldb-api :: lang/cpp/multiple-inheritance/TestCppMultipleInheritance.py (802 of 2814)
PASS: lldb-api :: lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py (803 of 2814)
FAIL: lldb-api :: lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py (804 of 2814)
******************** TEST 'lldb-api :: lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env ARCHIVER=/usr/local/bin/llvm-ar --env OBJCOPY=/usr/bin/llvm-objcopy --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --arch armv8l --build-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/dsymutil --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/lang/c/shared_lib_stripped_symbols -p TestSharedLibStrippedSymbols.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision a017ed04cc9bcc75b3c3ef35c923dbe7dc4606f8)
  clang revision a017ed04cc9bcc75b3c3ef35c923dbe7dc4606f8
  llvm revision a017ed04cc9bcc75b3c3ef35c923dbe7dc4606f8
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_expr_dsym (TestSharedLibStrippedSymbols.SharedLibStrippedTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_expr_dwarf (TestSharedLibStrippedSymbols.SharedLibStrippedTestCase)
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_expr_dwo (TestSharedLibStrippedSymbols.SharedLibStrippedTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_frame_variable_dsym (TestSharedLibStrippedSymbols.SharedLibStrippedTestCase) (test case does not fall in any category of interest for this run) 
XFAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_frame_variable_dwarf (TestSharedLibStrippedSymbols.SharedLibStrippedTestCase)
XFAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_frame_variable_dwo (TestSharedLibStrippedSymbols.SharedLibStrippedTestCase)
======================================================================
FAIL: test_expr_dwo (TestSharedLibStrippedSymbols.SharedLibStrippedTestCase)
   Test that types work when defined in a shared library and forwa/d-declared in the main executable
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1769, in test_method
    return attrvalue(self)
  File "/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py", line 24, in test_expr
    self.expect(
  File "/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2370, in expect
    self.runCmd(
  File "/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1000, in runCmd
    self.assertTrue(self.res.Succeeded(), msg + output)
AssertionError: False is not true : Variable(s) displayed correctly
Error output:

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 3, 2024

LLVM Buildbot has detected a new failure on builder openmp-offload-libc-amdgpu-runtime running on omp-vega20-1 while building clang at step 10 "Add check check-offload".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/6544

Here is the relevant piece of the build log for the reference
Step 10 (Add check check-offload) failure: test (failure)
******************** TEST 'libomptarget :: amdgcn-amd-amdhsa :: offloading/parallel_target_teams_reduction.cpp' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 1
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/clang++ -fopenmp    -I /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test -I /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -nogpulib -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib  -fopenmp-targets=amdgcn-amd-amdhsa /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/parallel_target_teams_reduction.cpp -o /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/parallel_target_teams_reduction.cpp.tmp -Xoffload-linker -lc -Xoffload-linker -lm /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a && /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/parallel_target_teams_reduction.cpp.tmp | /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/parallel_target_teams_reduction.cpp
# executed command: /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/clang++ -fopenmp -I /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test -I /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -nogpulib -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -fopenmp-targets=amdgcn-amd-amdhsa /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/parallel_target_teams_reduction.cpp -o /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/parallel_target_teams_reduction.cpp.tmp -Xoffload-linker -lc -Xoffload-linker -lm /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a
# executed command: /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/parallel_target_teams_reduction.cpp.tmp
# executed command: /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/parallel_target_teams_reduction.cpp
# RUN: at line 2
/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/clang++ -fopenmp    -I /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test -I /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -nogpulib -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib  -fopenmp-targets=amdgcn-amd-amdhsa -O3 /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/parallel_target_teams_reduction.cpp -o /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/parallel_target_teams_reduction.cpp.tmp -Xoffload-linker -lc -Xoffload-linker -lm /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a && /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/parallel_target_teams_reduction.cpp.tmp | /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/parallel_target_teams_reduction.cpp
# executed command: /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/clang++ -fopenmp -I /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test -I /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -L /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -nogpulib -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib -fopenmp-targets=amdgcn-amd-amdhsa -O3 /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/parallel_target_teams_reduction.cpp -o /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/parallel_target_teams_reduction.cpp.tmp -Xoffload-linker -lc -Xoffload-linker -lm /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a
# executed command: /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/offloading/Output/parallel_target_teams_reduction.cpp.tmp
# .---command stderr------------
# | AMDGPU error: Error in hsa_amd_memory_pool_allocate: HSA_STATUS_ERROR_OUT_OF_RESOURCES: The runtime failed to allocate the necessary resources. This error may also occur when the core runtime library needs to spawn threads or create internal OS-specific events.
# | AMDGPU error: Error in hsa_amd_memory_pool_allocate: HSA_STATUS_ERROR_OUT_OF_RESOURCES: The runtime failed to allocate the necessary resources. This error may also occur when the core runtime library needs to spawn threads or create internal OS-specific events.
# | "PluginInterface" error: Failure to allocate device memory for global memory pool: Failed to allocate from memory manager
# | AMDGPU fatal error 1: Received error in queue 0x7f4da02fa000: HSA_STATUS_ERROR_OUT_OF_RESOURCES: The runtime failed to allocate the necessary resources. This error may also occur when the core runtime library needs to spawn threads or create internal OS-specific events.
# `-----------------------------
# error: command failed with exit status: -6
# executed command: /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/parallel_target_teams_reduction.cpp
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/test/offloading/parallel_target_teams_reduction.cpp
# `-----------------------------
# error: command failed with exit status: 2

--

********************


@steakhal
Copy link
Contributor

steakhal commented Oct 4, 2024

FYI this PR likely caused a crash, reported in #111147.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:static analyzer clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants