1// RUN: %libomptarget-compilexx-generic
2// RUN: %libomptarget-run-generic
3// RUN: %libomptarget-compilexx-generic -DCTOR_KERNEL
4// RUN: %not --crash %libomptarget-run-generic
5// RUN: %libomptarget-compilexx-generic -DCTOR_API
6// RUN: %not --crash %libomptarget-run-generic
7
8#include <cstdio>
9#include <omp.h>
10
11void foo_dev() { __builtin_trap(); }
12
13#pragma omp declare variant(foo_dev) match(device = {kind(nohost)})
14void foo() {}
15
16struct S {
17 S() { foo(); }
18};
19
20S s;
21#pragma omp declare target(s)
22
23int main() {
24 int Dev = omp_get_default_device();
25
26#ifdef CTOR_KERNEL
27#pragma omp target
28 {}
29#endif
30#ifdef CTOR_API
31 omp_get_mapped_ptr(&s, Dev);
32#endif
33}
34

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

source code of offload/test/offloading/ctor_dtor_lazy.cpp