https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89377
Bug ID: 89377 Summary: [OMPVV SOLLVE] map of class member array with no modifier illegal memory access Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: josem at udel dot edu CC: jakub at gcc dot gnu.org Target Milestone: --- Created attachment 45740 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45740&action=edit Whole code Hello, The following code has a runtime error that generates an illegal memory acceess when calling the "modify()" method. Attached is a full version of the code. class A { private: int h_array[N]; int size; public: A(const int s) : size(s) { for (int i = 0; i < N; i++) h_array[i] = 0; } void modify() { #pragma omp target { for (int i = 0; i < size; ++i) h_array[i] += 1; } } int* getArray() { return &h_array[0]; } }; I've tried GCC 7.1 on a POWER system + P100, and GCC 8.2 on an Intel architecture + K40. On POWER it hangs, on Intel it breaks with the following: target_map_method_array.cpp.o: libgomp: cuCtxSynchronize error: an illegal memory access was encountered libgomp: cuMemFreeHost error: an illegal memory access was encountered libgomp: device finalization failed Thanks and have a great day