https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71844
Bug ID: 71844 Summary: Data mapping of an array section in the target construct Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: ka6ash at gmail dot com CC: jakub at gcc dot gnu.org Target Milestone: --- Hi, the following code from OpenMP examples 4.0.2(Section 58.3) causes an execution error. I suppose the problem is that the _target_ construct tries to map A[30] instead of using A[0:4]. The testsuit for libgomp contains a similar testcase but it has an additional _map_ clause for A: libgomp/testsuite/libgomp.c/examples-4/array_sections-4.c #pragma omp target map(p[7:20]) map(A[0:4]) *** Example code void foo () { int A[30], *p; #pragma omp target data map(A[0:4]) { p = &A[0]; #pragma omp target map(p[7:20]) { A[2] = 777; p[8] = 777; } } if (A[2] != 777 || A[8] != 777) printf("FAIL\n"); } *** Compilation flags $ x86_64-pc-linux-gnu-gcc -O2 -fopenmp source.c *** Error message libgomp: Trying to map into device [0x7fff9538a420..0x7fff9538a498) object when [0x7fff9538a420..0x7fff9538a430) is already mapped *** GCC $x86_64-pc-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=/install/bin/x86_64-pc-linux-gnu-gcc COLLECT_LTO_WRAPPER=/install/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper OFFLOAD_TARGET_NAMES=x86_64-intelmicemul-linux-gnu Target: x86_64-pc-linux-gnu Configured with: ../configure --disable-multilib --enable-languages=c,c++,fortran,lto --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --enable-offload-targets=x86_64-intelmicemul-linux-gnu --disable-bootstrap Thread model: posix gcc version 7.0.0 20160711 (experimental) (GCC)