https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101544

            Bug ID: 101544
           Summary: [OpenMP] 'declare target' block around class –
                    unresolved _Znwm = "operator new(unsigned long)"
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: openmp, wrong-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: cltang at gcc dot gnu.org, jakub at gcc dot gnu.org
  Target Milestone: ---

Created attachment 51184
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51184&action=edit
Testcase declare_target_base_class.cpp

>From https://github.com/SOLLVE/sollve_vv/pull/364
which is for https://github.com/SOLLVE/sollve_vv/issues/105

The code compiles with LLVM >= 12 but fails with LLVM < 12 according to the
sollve_vv issue.


The testcase – allegedly OpenMP 4.5 – fails to link with:

unresolved symbol _Znwm
collect2: error: ld returned 1 exit status
mkoffload: fatal error: x86_64-none-linux-gnu-accel-nvptx-none-gcc returned 1
exit status

where  "_Znwm" = "operator new(unsigned long)"


The code has:

+#pragma omp declare target
+class S {
...
+#pragma omp target map(ptr)
+      ptr = new S();
...
+#pragma omp end declare target

Reply via email to