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

--- Comment #4 from Benjamin Schulz <schulz.benjamin at googlemail dot com> ---
Yes, I would need to copyin t.

But anways, nvc++ compiles, without any problem this here:




#include <openacc.h>

struct mytensor
{
int *strides;
int *extents;
double *data;
};

int main()
{
mytensor t;

t.data=(double*)acc_malloc(sizeof(double)*20);
t.strides=(int*)acc_malloc(sizeof(int) *2);
t.extents=(int*)acc_malloc(sizeof(int) *2);


#pragma acc data copyin(t)

#pragma acc parallel loop gang present(t) deviceptr(t.data)
deviceptr(t.strides)deviceptr(t.extents)
 for(int i=1;i<20;i++)
    {
        t.data[i]=20;
    }

acc_free(t.data);
acc_free(t.extents);
acc_free(t.strides);
}



That is its output:

 16, Generating copyin(t) [if not already present]
         Generating present(t)
         Generating NVIDIA GPU code
         22, #pragma acc loop gang, vector(32) /* blockIdx.x threadIdx.x */
     22, Recognized memory set idiom



It accepts member fields in its constructs.

Reply via email to