https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83295
Bug ID: 83295 Summary: libgomp complains about trying to map data that is already mapped Product: gcc Version: 7.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: pophaless at ornl dot gov CC: jakub at gcc dot gnu.org Target Milestone: --- Created attachment 42798 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42798&action=edit full test to reproduce bug. Executing the attached code with gcc/7.1.1-20170802 cuda/8.0.61-1 code snippet: /* Initialize arrays a, b and c */ #pragma omp target enter data if(size > SIZE_THRESHOLD) map(to: size) map(to: c[0:size]) #pragma omp target if(size > SIZE_THRESHOLD) \ map(to: a[0:size], b[0:size]) map(tofrom: isHost)\ map(from: isOffloading) { isOffloading = !omp_is_initial_device(); isHost = omp_is_initial_device(); int alpha = (isHost ? 0 : 1); int j = 0; for (j = 0; j < size; j++) { // c[j] is zero if executed in the host // c[j] is 1+j if executed on the device c[j] = alpha*(a[j] + b[j]); } } // end target #pragma omp target exit data if(size > SIZE_THRESHOLD) map(from: c[0:size]) /*Check if array c was updated correctly*/ Compile line: gcc -O3 -std=c99 -fopenmp -foffload="-lm" -lm test.c -o tst Compiles without error. Error message at execution: libgomp: Trying to map into device [0x3fffc8f1a9e0..0x3fffc8f1b9e0) object when [0x3fffc8f1a9e0..0x3fffc8f1b5e0) is already mapped