Skip to content

[CIR] Upstream get_bitfield operation to load bit-field members from structs #145971

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 7 commits into from
Jul 2, 2025

Conversation

Andres-Salamanca
Copy link
Contributor

@Andres-Salamanca Andres-Salamanca commented Jun 26, 2025

This PR adds support for loading bit-field members from structs using the get_bitfield operation.
It enables retrieving the address of the bitfield-packed member but does not yet support volatile bitfields this will be addressed in a future PR.

@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Jun 26, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 26, 2025

@llvm/pr-subscribers-clangir

@llvm/pr-subscribers-clang

Author: None (Andres-Salamanca)

Changes

This PR adds support for retrieving a bitfield member. It obtains the member in which the bitfield is packed but does not emit the load operation, as the address will be computed later using the get_bitfield operation.


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

5 Files Affected:

  • (modified) clang/include/clang/CIR/MissingFeatures.h (+1)
  • (modified) clang/lib/CIR/CodeGen/CIRGenExpr.cpp (+43-4)
  • (modified) clang/lib/CIR/CodeGen/CIRGenFunction.h (+4)
  • (modified) clang/lib/CIR/CodeGen/CIRGenValue.h (+19)
  • (modified) clang/test/CIR/CodeGen/bitfields.c (+8)
diff --git a/clang/include/clang/CIR/MissingFeatures.h b/clang/include/clang/CIR/MissingFeatures.h
index 9e8944d1114b8..e136d73daac89 100644
--- a/clang/include/clang/CIR/MissingFeatures.h
+++ b/clang/include/clang/CIR/MissingFeatures.h
@@ -200,6 +200,7 @@ struct MissingFeatures {
   static bool fastMathFlags() { return false; }
   static bool fpConstraints() { return false; }
   static bool generateDebugInfo() { return false; }
+  static bool getBitfieldOp() { return false; }
   static bool hip() { return false; }
   static bool implicitConstructorArgs() { return false; }
   static bool incrementProfileCounter() { return false; }
diff --git a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
index 5c6604d784156..a3d24e92c701a 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
@@ -326,13 +326,47 @@ mlir::Value CIRGenFunction::emitStoreThroughBitfieldLValue(RValue src,
   return {};
 }
 
+Address CIRGenFunction::getAddrOfBitFieldStorage(LValue base,
+                                                 const FieldDecl *field,
+                                                 mlir::Type fieldType,
+                                                 unsigned index) {
+  if (index == 0)
+    return base.getAddress();
+  mlir::Location loc = getLoc(field->getLocation());
+  cir::PointerType fieldPtr = cir::PointerType::get(fieldType);
+  cir::GetMemberOp sea = getBuilder().createGetMember(
+      loc, fieldPtr, base.getPointer(), field->getName(), index);
+  return Address(sea, CharUnits::One());
+}
+
+LValue CIRGenFunction::emitLValueForBitField(LValue base,
+                                             const FieldDecl *field) {
+  LValueBaseInfo baseInfo = base.getBaseInfo();
+  const CIRGenRecordLayout &layout =
+      cgm.getTypes().getCIRGenRecordLayout(field->getParent());
+  const CIRGenBitFieldInfo &info = layout.getBitFieldInfo(field);
+  assert(!cir::MissingFeatures::armComputeVolatileBitfields());
+  unsigned idx = layout.getCIRFieldNo(field);
+
+  Address addr = getAddrOfBitFieldStorage(base, field, info.storageType, idx);
+
+  mlir::Location loc = getLoc(field->getLocation());
+  if (addr.getElementType() != info.storageType)
+    addr = builder.createElementBitCast(loc, addr, info.storageType);
+
+  QualType fieldType =
+      field->getType().withCVRQualifiers(base.getVRQualifiers());
+  // TODO(cir): Support TBAA for bit fields.
+  assert(!cir::MissingFeatures::opTBAA());
+  LValueBaseInfo fieldBaseInfo(baseInfo.getAlignmentSource());
+  return LValue::makeBitfield(addr, info, fieldType, fieldBaseInfo);
+}
+
 LValue CIRGenFunction::emitLValueForField(LValue base, const FieldDecl *field) {
   LValueBaseInfo baseInfo = base.getBaseInfo();
 
-  if (field->isBitField()) {
-    cgm.errorNYI(field->getSourceRange(), "emitLValueForField: bitfield");
-    return LValue();
-  }
+  if (field->isBitField())
+    return emitLValueForBitField(base, field);
 
   QualType fieldType = field->getType();
   const RecordDecl *rec = field->getParent();
@@ -460,6 +494,11 @@ RValue CIRGenFunction::emitLoadOfLValue(LValue lv, SourceLocation loc) {
   assert(!lv.getType()->isFunctionType());
   assert(!(lv.getType()->isConstantMatrixType()) && "not implemented");
 
+  if (lv.isBitField()) {
+    assert(!cir::MissingFeatures::getBitfieldOp());
+    return RValue::getIgnored();
+  }
+
   if (lv.isSimple())
     return RValue::get(emitLoadOfScalar(lv, loc));
 
diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h
index 2e54243f18cff..5139bc8249b3d 100644
--- a/clang/lib/CIR/CodeGen/CIRGenFunction.h
+++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h
@@ -550,6 +550,9 @@ class CIRGenFunction : public CIRGenTypeCache {
     return it->second;
   }
 
+  Address getAddrOfBitFieldStorage(LValue base, const clang::FieldDecl *field,
+                                   mlir::Type fieldType, unsigned index);
+
   /// Load the value for 'this'. This function is only valid while generating
   /// code for an C++ member function.
   /// FIXME(cir): this should return a mlir::Value!
@@ -964,6 +967,7 @@ class CIRGenFunction : public CIRGenTypeCache {
   /// of the expression.
   /// FIXME: document this function better.
   LValue emitLValue(const clang::Expr *e);
+  LValue emitLValueForBitField(LValue base, const FieldDecl *field);
   LValue emitLValueForField(LValue base, const clang::FieldDecl *field);
 
   /// Like emitLValueForField, excpet that if the Field is a reference, this
diff --git a/clang/lib/CIR/CodeGen/CIRGenValue.h b/clang/lib/CIR/CodeGen/CIRGenValue.h
index a5a457ddafa9c..2d6bdb921c9fa 100644
--- a/clang/lib/CIR/CodeGen/CIRGenValue.h
+++ b/clang/lib/CIR/CodeGen/CIRGenValue.h
@@ -19,6 +19,7 @@
 #include "clang/AST/CharUnits.h"
 #include "clang/AST/Type.h"
 
+#include "CIRGenRecordLayout.h"
 #include "mlir/IR/Value.h"
 
 #include "clang/CIR/MissingFeatures.h"
@@ -162,6 +163,7 @@ class LValue {
   mlir::Value vectorIdx; // Index for vector subscript
   mlir::Type elementType;
   LValueBaseInfo baseInfo;
+  const CIRGenBitFieldInfo *bitFieldInfo{nullptr};
 
   void initialize(clang::QualType type, clang::Qualifiers quals,
                   clang::CharUnits alignment, LValueBaseInfo baseInfo) {
@@ -245,6 +247,23 @@ class LValue {
     r.initialize(t, t.getQualifiers(), vecAddress.getAlignment(), baseInfo);
     return r;
   }
+
+  /// Create a new object to represent a bit-field access.
+  ///
+  /// \param Addr - The base address of the bit-field sequence this
+  /// bit-field refers to.
+  /// \param Info - The information describing how to perform the bit-field
+  /// access.
+  static LValue makeBitfield(Address addr, const CIRGenBitFieldInfo &info,
+                             clang::QualType type, LValueBaseInfo baseInfo) {
+    LValue r;
+    r.lvType = BitField;
+    r.v = addr.getPointer();
+    r.elementType = addr.getElementType();
+    r.bitFieldInfo = &info;
+    r.initialize(type, type.getQualifiers(), addr.getAlignment(), baseInfo);
+    return r;
+  }
 };
 
 /// An aggregate value slot.
diff --git a/clang/test/CIR/CodeGen/bitfields.c b/clang/test/CIR/CodeGen/bitfields.c
index ff5c6bc1787b4..4cc1fc69ecc5a 100644
--- a/clang/test/CIR/CodeGen/bitfields.c
+++ b/clang/test/CIR/CodeGen/bitfields.c
@@ -76,3 +76,11 @@ void def() {
   T t;
   U u;
 }
+
+// CIR: cir.func {{.*@load_field}}
+// CIR:   [[TMP0:%.*]] = cir.alloca !cir.ptr<!rec_S>, !cir.ptr<!cir.ptr<!rec_S>>, ["s", init]
+// CIR:   [[TMP1:%.*]] = cir.load{{.*}} [[TMP0]] : !cir.ptr<!cir.ptr<!rec_S>>, !cir.ptr<!rec_S>
+// CIR:   [[TMP2:%.*]] = cir.get_member %2[1] {name = "e"} : !cir.ptr<!rec_S> -> !cir.ptr<!u16i>
+int load_field(S* s) {
+  return s->e;
+}

@Andres-Salamanca Andres-Salamanca changed the title [CIR] Get Lvalue for bit-field [CIR] Add support for retrieving bitfield member Jun 26, 2025
Copy link
Contributor

@andykaylor andykaylor left a comment

Choose a reason for hiding this comment

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

I appreciate the small change, but in this case I think it would be better to introduce get_bitfield together with this code, because the expected behavior without it is unclear and difficult to evaluate.

@Andres-Salamanca
Copy link
Contributor Author

I initially split this out because I also need to introduce a BitfieldInfoAttr, and combining everything in one patch would make it quite long. That said, I was already working on this in another branch, so I’ll go ahead and bring that code over and include get_bitfield here as well.

@Andres-Salamanca Andres-Salamanca changed the title [CIR] Add support for retrieving bitfield member [CIR] Upstream get_bitfield operation to load bit-field members from structs Jun 27, 2025
@Andres-Salamanca
Copy link
Contributor Author

@erichkeane

Copy link
Collaborator

@erichkeane erichkeane left a comment

Choose a reason for hiding this comment

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

A couple of nits to docs, else this looks fine to me. I think @bcardosolopes should probably approve this though.

Copy link

github-actions bot commented Jul 1, 2025

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

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

One minor suggestion and LGTM

@Andres-Salamanca Andres-Salamanca merged commit 717899c into llvm:main Jul 2, 2025
9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 2, 2025

LLVM Buildbot has detected a new failure on builder hip-third-party-libs-test running on ext_buildbot_hw_05-hip-docker while building clang at step 4 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/hip-tpl.py --jobs=32' (failure)
...
[7783/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/FrontendOptions.cpp.o
[7784/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/TextDiagnosticBuffer.cpp.o
[7785/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/TextDiagnosticPrinter.cpp.o
[7786/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/CodeGenOptions.cpp.o
[7787/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/TextDiagnostic.cpp.o
[7788/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/CompilerInvocation.cpp.o
[7789/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/CompilerInstance.cpp.o
[7790/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/FrontendAction.cpp.o
[7791/7899] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-integer.cpp.o
[7792/7899] Linking CXX shared library lib/libFortranEvaluate.so.21.0git
FAILED: lib/libFortranEvaluate.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-ctad-maybe-unsupported -fno-semantic-interposition -fpch-preprocess -O3 -DNDEBUG -fno-semantic-interposition  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/hip-third-party-libs-test/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libFortranEvaluate.so.21.0git -o lib/libFortranEvaluate.so.21.0git tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/call.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/characteristics.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/check-expression.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/common.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/complex.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/constant.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/expression.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-character.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-complex.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-designator.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-integer.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-logical.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-real.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-reduction.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/formatting.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/host.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/initial-image.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/integer.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics-library.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/logical.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/real.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/shape.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/static-data.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/target.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/tools.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/type.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/variable.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/hip-third-party-libs-test/build/lib:"  lib/libFortranDecimal.so.21.0git  lib/libFortranParser.so.21.0git  -lquadmath  lib/libFortranSupport.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/hip-third-party-libs-test/build/lib && :
/usr/bin/ld: tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/tools.cpp.o: in function `Fortran::semantics::CanCUDASymbolHaveSaveAttr(Fortran::semantics::Symbol const&) [clone .localalias]':
tools.cpp:(.text._ZN7Fortran9semantics25CanCUDASymbolHaveSaveAttrERKNS0_6SymbolE+0x76): undefined reference to `Fortran::semantics::FindCUDADeviceAllocatableUltimateComponent(Fortran::semantics::DerivedTypeSpec const&)'
collect2: error: ld returned 1 exit status
[7793/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/LoweringOptions.cpp.o
[7794/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Runtime.cpp.o
[7795/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/SymbolMap.cpp.o
[7796/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Coarray.cpp.o
[7797/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ComponentPath.cpp.o
[7798/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Support/PrivateReductionUtils.cpp.o
[7799/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/IterationSpace.cpp.o
[7800/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/HlfirIntrinsics.cpp.o
[7801/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/ReductionProcessor.cpp.o
[7802/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Mangler.cpp.o
[7803/7899] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/expression.cpp.o
[7804/7899] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/semantics.cpp.o
[7805/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/CallInterface.cpp.o
[7806/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertProcedureDesignator.cpp.o
[7807/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertType.cpp.o
[7808/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/VectorSubscripts.cpp.o
[7809/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Allocatable.cpp.o
[7810/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertCall.cpp.o
[7811/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/CustomIntrinsicCall.cpp.o
[7812/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertConstant.cpp.o
[7813/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/IO.cpp.o
[7814/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/HostAssociations.cpp.o
[7815/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertArrayConstructor.cpp.o
[7816/7899] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/resolve-names.cpp.o
[7817/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Utils.cpp.o
[7818/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertVariable.cpp.o
[7819/7899] Building CXX object tools/flang/tools/bbc/CMakeFiles/bbc.dir/bbc.cpp.o
[7820/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Atomic.cpp.o
[7821/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/FrontendActions.cpp.o
[7822/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Bridge.cpp.o
[7823/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertExprToHLFIR.cpp.o
[7824/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Decomposer.cpp.o
[7825/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/ClauseProcessor.cpp.o
[7826/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Support/Utils.cpp.o
Step 7 (build cmake config) failure: build cmake config (failure)
...
[7783/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/FrontendOptions.cpp.o
[7784/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/TextDiagnosticBuffer.cpp.o
[7785/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/TextDiagnosticPrinter.cpp.o
[7786/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/CodeGenOptions.cpp.o
[7787/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/TextDiagnostic.cpp.o
[7788/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/CompilerInvocation.cpp.o
[7789/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/CompilerInstance.cpp.o
[7790/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/FrontendAction.cpp.o
[7791/7899] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-integer.cpp.o
[7792/7899] Linking CXX shared library lib/libFortranEvaluate.so.21.0git
FAILED: lib/libFortranEvaluate.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-ctad-maybe-unsupported -fno-semantic-interposition -fpch-preprocess -O3 -DNDEBUG -fno-semantic-interposition  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/hip-third-party-libs-test/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libFortranEvaluate.so.21.0git -o lib/libFortranEvaluate.so.21.0git tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/call.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/characteristics.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/check-expression.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/common.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/complex.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/constant.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/expression.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-character.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-complex.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-designator.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-integer.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-logical.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-real.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-reduction.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/formatting.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/host.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/initial-image.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/integer.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics-library.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/logical.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/real.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/shape.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/static-data.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/target.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/tools.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/type.cpp.o tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/variable.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/hip-third-party-libs-test/build/lib:"  lib/libFortranDecimal.so.21.0git  lib/libFortranParser.so.21.0git  -lquadmath  lib/libFortranSupport.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/hip-third-party-libs-test/build/lib && :
/usr/bin/ld: tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/tools.cpp.o: in function `Fortran::semantics::CanCUDASymbolHaveSaveAttr(Fortran::semantics::Symbol const&) [clone .localalias]':
tools.cpp:(.text._ZN7Fortran9semantics25CanCUDASymbolHaveSaveAttrERKNS0_6SymbolE+0x76): undefined reference to `Fortran::semantics::FindCUDADeviceAllocatableUltimateComponent(Fortran::semantics::DerivedTypeSpec const&)'
collect2: error: ld returned 1 exit status
[7793/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/LoweringOptions.cpp.o
[7794/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Runtime.cpp.o
[7795/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/SymbolMap.cpp.o
[7796/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Coarray.cpp.o
[7797/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ComponentPath.cpp.o
[7798/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Support/PrivateReductionUtils.cpp.o
[7799/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/IterationSpace.cpp.o
[7800/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/HlfirIntrinsics.cpp.o
[7801/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/ReductionProcessor.cpp.o
[7802/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Mangler.cpp.o
[7803/7899] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/expression.cpp.o
[7804/7899] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/semantics.cpp.o
[7805/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/CallInterface.cpp.o
[7806/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertProcedureDesignator.cpp.o
[7807/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertType.cpp.o
[7808/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/VectorSubscripts.cpp.o
[7809/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Allocatable.cpp.o
[7810/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertCall.cpp.o
[7811/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/CustomIntrinsicCall.cpp.o
[7812/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertConstant.cpp.o
[7813/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/IO.cpp.o
[7814/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/HostAssociations.cpp.o
[7815/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertArrayConstructor.cpp.o
[7816/7899] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/resolve-names.cpp.o
[7817/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Utils.cpp.o
[7818/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertVariable.cpp.o
[7819/7899] Building CXX object tools/flang/tools/bbc/CMakeFiles/bbc.dir/bbc.cpp.o
[7820/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Atomic.cpp.o
[7821/7899] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/FrontendActions.cpp.o
[7822/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Bridge.cpp.o
[7823/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/ConvertExprToHLFIR.cpp.o
[7824/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/Decomposer.cpp.o
[7825/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/OpenMP/ClauseProcessor.cpp.o
[7826/7899] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/Support/Utils.cpp.o

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

Successfully merging this pull request may close these issues.

6 participants