[Openmp-commits] [openmp] [libomp] Fix debug build after #176164 (PR #215961)

Robert Imschweiler via Openmp-commits openmp-commits at lists.llvm.org
Wed Aug 12 23:17:56 PDT 2026


https://github.com/ro-i created https://github.com/llvm/llvm-project/pull/215961

Fixes https://github.com/llvm/llvm-project/issues/215937.

>From 0b4cdc19f7d05daf219473e11c422794a8d90e4d Mon Sep 17 00:00:00 2001
From: Robert Imschweiler <robert.imschweiler at amd.com>
Date: Thu, 13 Aug 2026 01:15:59 -0500
Subject: [PATCH] [libomp] Fix debug build after #176164

Fixes https://github.com/llvm/llvm-project/issues/215937.
---
 openmp/runtime/src/kmp_traits.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/openmp/runtime/src/kmp_traits.h b/openmp/runtime/src/kmp_traits.h
index ed19ceccd8846..66913bd9db22c 100644
--- a/openmp/runtime/src/kmp_traits.h
+++ b/openmp/runtime/src/kmp_traits.h
@@ -103,7 +103,12 @@ class kmp_trait {
   kmp_trait &operator=(const kmp_trait &) = delete;
   kmp_trait &operator=(kmp_trait &&) = delete;
 
-  virtual bool match(int device) const = 0;
+  // Not pure virtual to avoid a dependency on __cxa_pure_virtual, which lives
+  // in libsupc++ and is not linked into libomp. Derived classes must override.
+  virtual bool match([[maybe_unused]] int device) const {
+    KMP_ASSERT2(0, "kmp_trait::match() must be overridden");
+    return false;
+  }
 
   // Use KMP_INTERNAL_MALLOC/KMP_INTERNAL_FREE for memory management.
   void *operator new(size_t size) { return KMP_INTERNAL_MALLOC(size); }
@@ -199,7 +204,13 @@ class kmp_trait_expr {
   kmp_trait_expr(expr_type type, bool negated)
       : _type(type), negated(negated) {}
 
-  virtual bool match_impl(int device, int num_devices) const = 0;
+  // Not pure virtual to avoid a dependency on __cxa_pure_virtual, which lives
+  // in libsupc++ and is not linked into libomp. Derived classes must override.
+  virtual bool match_impl([[maybe_unused]] int device,
+                          [[maybe_unused]] int num_devices) const {
+    KMP_ASSERT2(0, "kmp_trait_expr::match_impl() must be overridden");
+    return false;
+  }
 
 public:
   virtual ~kmp_trait_expr() = default;



More information about the Openmp-commits mailing list