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



janus at gcc dot gnu.org changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |janus at gcc dot gnu.org

            Version|fortran-dev                 |4.9.0

            Summary|Allocatable array of        |[OOP] Allocatable array:

                   |extended type, wrong        |wrong offset when passing

                   |indexes after passing to a  |to CLASS dummy

                   |subroutine                  |



--- Comment #3 from janus at gcc dot gnu.org 2013-03-23 13:10:41 UTC ---

Reduced test case which shows that the problem is CLASS-specific:





module m2

 implicit none

 type :: t_stv

  real :: f1

 end type

contains

 subroutine lcb(y)

  class(t_stv), intent(in) :: y(:)

   write(*,*) 'Inside LCB: size is ',size(y)

   print *,y(1:size(y))%f1

 end subroutine

end module



program test

 use m2

 implicit none



 type(t_stv), allocatable :: work(:)



  allocate(work(4))

  work(:)%f1 = (/ 1.,2.,3.,4./)

  write(*,*) 'Values in work are:'

  print *, work(1:4)%f1



  write(*,*) 'Call with whole array: works fine'

  call lcb(work)

  write(*,*) 'Call with array slice: off by 1'

  call lcb(work(:4))



end program





When making 'y' a TYPE instead of CLASS, the output is as expected.

Reply via email to