This code compiles fine on all other known f95 compilers but gives an error in
gfortran (code compiled with __GFORTRAN__ works, alternative does not):



  type real_pointer
    real, dimension(:), pointer :: p
  end type real_pointer


...
      recursive subroutine QuickSortArr_Real(Arr, Lin, R, index)
      !Sorts an array of pointers to arrays of reals by the value of the
index'th entry
      integer, intent(in) :: Lin, R, index
#ifdef __GFORTRAN__
      type(real_pointer), dimension(:) :: Arr
#else
      type(real_pointer), dimension(*) :: Arr
#endif
      integer I, J, L
      real P
      type(real_pointer) :: temp

      L = Lin
      do

      I = L
      J = R
      P = Arr((L + R)/2)%p(index)

      do
      do while (Arr(I)%p(index) <  P) 
         I = I + 1
      end do

      do while (Arr(J)%p(index) > P) 
         J = J - 1
      end do

      if (I <= J) then

       Temp%p => Arr(I)%p
       Arr(I)%p => Arr(J)%p
       Arr(J)%p => Temp%p
       I = I + 1
       J = J - 1
      end if
      if (I > J) exit

      end do
    if (L < J) call QuickSortArr_Real(Arr, L, J, index);
    L = I
    if (I >= R) exit
    end do

    end subroutine QuickSortArr_Real


-- 
           Summary: Valid pointer assigment code gives compilation errors
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: antony at cosmologist dot info


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

Reply via email to