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

            Bug ID: 71194
           Summary: ICE on compilation with fcheck=all ; -fcheck=bounds
           Product: gcc
           Version: 5.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: t.kondic at leeds dot ac.uk
  Target Milestone: ---

The following code crashes the compiler when compiled with the -fcheck=all, or
-fcheck=bounds options:

program ice
implicit none
integer, parameter :: pa=10, pb=20
complex, target :: a(pa*pb)
real, pointer:: ptr(:,:) =>null()


ptr(1:pa,1:pb) => conv2real(a)

contains
  function conv2real(carr)
    use, intrinsic :: iso_c_binding
    ! returns real pointer to a complex array
    complex, contiguous, intent(inout), target  :: carr(:)
    real,contiguous,pointer :: conv2real(:)
    call c_f_pointer(c_loc(carr),conv2real,[size(carr)*2])
  end function conv2real
end program


It is the pointer assignment that causes the crash.

Reply via email to