[Bug middle-end/104563] New: [OpenMP] ICE in install_var_field, at omp-low.cc:810 (multi map of same var)

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 16 10:05:27 GMT 2022


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

            Bug ID: 104563
           Summary: [OpenMP] ICE in install_var_field, at omp-low.cc:810
                    (multi map of same var)
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Found in
https://github.com/SOLLVE/sollve_vv/blob/master/tests/5.0/target/test_target_mapping_before_alloc.F90
(See also https://github.com/SOLLVE/sollve_vv/issues/464 )

Compiling that testcase with GCC gfortran (7, 8, 9, 10, 11 and) mainline fails
as follows.

I think the problem is that scalar/a/test_struct appear multiple times, which
is invalid in OpenMP 4.5 but valid since 5.0.

Thus, the solution for 4.5 would be to diagnose this - and for 5.0 to accept
this.


tests/5.0/target/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.cc:810
0x732767 install_var_field
        ../../repos/gcc/gcc/omp-low.cc:810
0xeafbce scan_sharing_clauses
        ../../repos/gcc/gcc/omp-low.cc:1622
0xeb0feb scan_omp_target
        ../../repos/gcc/gcc/omp-low.cc:3050
0xeb221b scan_omp_1_stmt
        ../../repos/gcc/gcc/omp-low.cc:4241


Slightly reduced testcase:

SUBROUTINE foo
    INTEGER :: x, scalar
    INTEGER, DIMENSION(10) :: a

    TYPE structure
       INTEGER :: var
       INTEGER,DIMENSION(10) :: b
    END TYPE structure
    TYPE(structure) :: test_struct
    test_struct%var = 1
    a(:) = 42
    test_struct%b(:) = 42
    scalar = 80

    !$omp target map(alloc: scalar, a, test_struct) map(to: scalar, a,
test_struct)
      if (scalar /= 80 .OR. a(2) .ne. 42 .OR. test_struct%var /= 1 .OR.
test_struct%b(2) /= 42) stop 1
    !$omp end target
END


More information about the Gcc-bugs mailing list