Skip to content

Commit 970e745

Browse files
authored
[Libomptarget] Add a test for the libc implementation of assert (llvm#69518)
Summary: The `libcgpu.a` file provides its own implementation of `__assert_fail`. This adds a test to make sure it's usable in OpenMP offloading as expected. Currently this requires linking `libcgpu.a` before the OpenMP device RTL however. We also disable the test on the CPU as the format of the string will be different.
1 parent 311f725 commit 970e745

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %libomptarget-compile-generic && %libomptarget-run-fail-generic 2>&1 | \
2+
// RUN: %fcheck-generic --check-prefix=CHECK
3+
4+
// REQUIRES: libc
5+
6+
// UNSUPPORTED: powerpc64-ibm-linux-gnu
7+
// UNSUPPORTED: powerpc64-ibm-linux-gnu-LTO
8+
// UNSUPPORTED: aarch64-unknown-linux-gnu
9+
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
10+
// UNSUPPORTED: x86_64-pc-linux-gnu
11+
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
12+
13+
#include <assert.h>
14+
15+
int main() {
16+
// CHECK: Assertion failed: '0 && "Trivial failure"' in function: 'int main()'
17+
// CHECK-NOT: Assertion failed:
18+
#pragma omp target
19+
#pragma omp parallel
20+
{ assert(0 && "Trivial failure"); }
21+
}

0 commit comments

Comments
 (0)