https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99400
Bug ID: 99400 Summary: OpenMP: ICE in install_var_field, at omp-low.c:789 with "map(alloc: A) map(to: A)" Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: openmp, patch Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Target Milestone: --- SOLLVE_VV Fortran test – this one is https://github.com/SOLLVE/sollve_vv/pull/306 TRACKING: Patch exists on a branch (and was possibly submitted for mainline at some point) – but it is not yet on mainline. The testcase does "map(alloc: A) map(to: A)" which should be valid OpenMP 5 and invalid OpenMP 4.5 The C testcase fails on *mainline* with: tests/5.0/target/test_target_mapping_before_alloc.c:40:41: error: ‘a’ appears more than once in map clauses On the *OG10* (devel/omp/gcc-10) branch, the C and Fortran testcases compile. (I have no done a run-time check.) Hence, one of Chung-Lin's mapping patches did fix it... TODO: Wait until it lands and then commit a Fortran testcase as well. On mainline, gfortran fails as follows: gfortran -fopenmp -I ompvv test_target_mapping_before_alloc.F90 during GIMPLE pass: omplower test_target_mapping_before_alloc.F90:51:43: 51 | !$omp& test_struct) map(tofrom: errors) | ^ internal compiler error: in install_var_field, at omp-low.c:789 0x6ed020 install_var_field ../../repos/gcc/gcc/omp-low.c:789 0xe06466 scan_sharing_clauses ../../repos/gcc/gcc/omp-low.c:1543 0xe07cdb scan_omp_target ../../repos/gcc/gcc/omp-low.c:2946 0xe08c14 scan_omp_1_stmt ../../repos/gcc/gcc/omp-low.c:4029 * * * INTEGER :: errors, x, scalar INTEGER,DIMENSION(N) :: a TYPE structure INTEGER :: var INTEGER,DIMENSION(N) :: b END TYPE structure TYPE(structure) :: test_struct test_struct%var = 1 DO x = 1, N a(x) = x test_struct%b(x) = x END DO scalar = 80 errors = 0 !$omp target map(alloc: scalar, a, test_struct) map(to: scalar, a, & !$omp& test_struct) map(tofrom: errors) IF (scalar .ne. 80 .OR. a(2) .ne. 2 .OR. test_struct%var .ne. 1 & & .OR. test_struct%b(2) .ne. 2) THEN errors = errors + 1 END IF !$omp end target