Test case:

program F03_2_9_1_1_2b
   use omp_lib
   implicit none
   integer, parameter :: NT = 4
   integer :: explicit_shape_array(NT,0:NT-1) = -1 ! invalid value
   integer :: row, thread_num

   call omp_set_dynamic(.false.)
   call omp_set_num_threads(NT)

   call test_assumed_size_array(explicit_shape_array, &
                                size(explicit_shape_array,1))

   do thread_num = 0, NT-1
      do row = 1, NT
         if (explicit_shape_array(row, thread_num) /= thread_num) then
            print *, 'FAIL - explicit_shape_array(', row, &
                     ',', thread_num,')',&
                     ') == ', explicit_shape_array(row, thread_num), &
                     ' (expected ', row, ')'
         stop 1
         end if
      end do
   end do

contains
   subroutine test_assumed_size_array(assumed_size_array, dim1)
      use omp_lib
      implicit none
      integer :: dim1, assumed_size_array(dim1,0:*) ! size is dim1*dim1
      integer :: i
!$omp parallel
!$omp task if (.false.) shared(assumed_size_array)
      do row = 1, dim1 !"row" predetermined shared per 
                       ! OpenMP 3.0 p. 78 l.26-27
         assumed_size_array(row, omp_get_thread_num())= omp_get_thread_num()
      end do
!$omp end task
!$omp end parallel
   end subroutine test_assumed_size_array
end program F03_2_9_1_1_2b


Compilation:

> gfortran -fopenmp test.f90
test.f90: In function 'test_assumed_size_array':
test.f90:35: internal compiler error: in lookup_decl_in_outer_ctx, at
omp-low.c:2103
Please submit a full bug report,
with preprocessed source if appropriate.


Workaround:

In the contained routine, declare the variable row locally:

<       integer :: i
---
>       integer :: i, row


-- 
           Summary: ICE: in lookup_decl_in_outer_ctx, at omp-low.c:2103
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: longb at cray dot com
 GCC build triplet: x86_64-suse-linux
  GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43337

Reply via email to