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

            Bug ID: 120753
           Summary: is_device_ptr does not compile with pointers in struct
                    elements..
           Product: gcc
           Version: 15.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: schulz.benjamin at googlemail dot com
  Target Milestone: ---

#include <omp.h>

struct arraystruct
{
int A;
double* t;
};

int main()
{

arraystruct u;

u.t=(double*)omp_target_alloc(sizeof(double)*20,omp_get_default_device());

#pragma omp target is_device_ptr(u.t)
#pragma omp teams distribute
    for(size_t i=1;i<20;i++)
    {
        u.t[i]=20;
    }

compile with

-fopenmp -foffload=nvptx-none  -fno-stack-protector -std=c++23

fails with

 /home/benni/projects/openmptestnew/openmpoffloatest/main.cpp: In function »int
main()«:
/home/benni/projects/openmptestnew/openmpoffloatest/main.cpp:17:35: Fehler:
expected »)« before ».« token
   17 | #pragma omp target is_device_ptr(u.t)
      |                                   ^
      |                                   )
/home/benni/projects/openmptestnew/openmpoffloatest/main.cpp:17:34: Fehler:
Variable »is_device_ptr« ist neither pointer nor array nor reference on pointer
or array
   17 | #pragma omp target is_device_ptr(u.t)
      |                                  ^


well, I am pretty sure that u.t is a pointer that I've allocated on device...
Gcc appears not to follow the dots...

Reply via email to