https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69183
--- Comment #4 from Gerhard Steinmetz <gerhard.steinmetz.fort...@t-online.de> --- Related (modified example from testsuite) : $ cat z3.f90 subroutine gang (a) !$acc routine gang integer, intent(inout) :: a(n) integer, allocatable :: i !$acc loop do i = 1, 2 a(i) = a(i) - a(i) end do !$acc loop gang do i = 1, 2 a(i) = a(i) - a(i) end do !$acc loop worker do i = 1, 2 a(i) = a(i) - a(i) end do !$acc loop vector do i = 1, 2 a(i) = a(i) - a(i) end do end subroutine worker (a) !$acc routine worker integer, intent(inout) :: a(n) integer, allocatable :: i !$acc loop do i = 1, 2 a(i) = a(i) - a(i) end do !$acc loop worker do i = 1, 2 a(i) = a(i) - a(i) end do !$acc loop vector do i = 1, 2 a(i) = a(i) - a(i) end do end subroutine vector (a) !$acc routine vector integer, intent(inout) :: a(n) integer, allocatable :: i !$acc loop do i = 1, 2 a(i) = a(i) - a(i) end do !$acc loop vector do i = 1, 2 a(i) = a(i) - a(i) end do end subroutine seq (a) !$acc routine seq integer, intent(inout) :: a(n) integer, allocatable :: i !$acc loop do i = 1, 2 a(i) = a(i) - a(i) end do end $ gfortran-7-20161113 -fopenacc -c z3.f90 z3.f90:5:0: !$acc loop internal compiler error: in build_outer_var_ref, at omp-low.c:1361 0xb27aa2 build_outer_var_ref ../../gcc/omp-low.c:1361 0xb41f7a lower_rec_input_clauses ../../gcc/omp-low.c:4947 0xb486e9 lower_omp_for ../../gcc/omp-low.c:15196 0xb38856 lower_omp_1 ../../gcc/omp-low.c:17106 0xb38856 lower_omp ../../gcc/omp-low.c:17243 0xb3838c lower_omp_1 ../../gcc/omp-low.c:17091 0xb3838c lower_omp ../../gcc/omp-low.c:17243 0xb379ec lower_omp_1 ../../gcc/omp-low.c:17082 0xb379ec lower_omp ../../gcc/omp-low.c:17243 0xb3838c lower_omp_1 ../../gcc/omp-low.c:17091 0xb3838c lower_omp ../../gcc/omp-low.c:17243 0xb3f56f execute_lower_omp ../../gcc/omp-low.c:17978 0xb3f56f execute ../../gcc/omp-low.c:18015