[Openmp-commits] [PATCH] D109886: [OpenMP] Implement __assert_fail in the new device runtime

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Sep 17 18:25:59 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb266bcb13557: [OpenMP] Implement __assert_fail in the new device runtime (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109886/new/

https://reviews.llvm.org/D109886

Files:
  openmp/libomptarget/DeviceRTL/include/Debug.h
  openmp/libomptarget/DeviceRTL/src/Debug.cpp


Index: openmp/libomptarget/DeviceRTL/src/Debug.cpp
===================================================================
--- openmp/libomptarget/DeviceRTL/src/Debug.cpp
+++ openmp/libomptarget/DeviceRTL/src/Debug.cpp
@@ -26,6 +26,13 @@
 
   __builtin_assume(cond);
 }
+
+void __assert_fail(const char *assertion, const char *file, unsigned line,
+                   const char *function) {
+  PRINTF("%s:%u: %s: Assertion `%s' failed.\n", file, line, function,
+         assertion);
+  __builtin_trap();
+}
 }
 
 #pragma omp end declare target
Index: openmp/libomptarget/DeviceRTL/include/Debug.h
===================================================================
--- openmp/libomptarget/DeviceRTL/include/Debug.h
+++ openmp/libomptarget/DeviceRTL/include/Debug.h
@@ -17,6 +17,8 @@
 /// {
 extern "C" {
 void __assert_assume(bool cond, const char *exp, const char *file, int line);
+void __assert_fail(const char *assertion, const char *file, unsigned line,
+                   const char *function);
 }
 
 #define ASSERT(e) __assert_assume(e, #e, __FILE__, __LINE__)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109886.373380.patch
Type: text/x-patch
Size: 1067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210918/24e1da1f/attachment.bin>


More information about the Openmp-commits mailing list