[Bug fortran/88447] Non-contiguous array argument of some class not passed properly to subroutine

mscfd at gmx dot net gcc-bugzilla@gcc.gnu.org
Tue Dec 11 09:21:00 GMT 2018


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

--- Comment #1 from martin <mscfd at gmx dot net> ---
Here is a smaller reproducer. The component "integer :: i" in type t is
necessary to reproduce the bug.

module mod

implicit none
private

public qv

type, public :: s
   real, dimension(1:3) :: vec
end type s

type, public :: t
   integer :: i
   type(s) :: v
end type t


contains


subroutine qv(x)
   class(s), dimension(:), intent(in) :: x
   integer :: i
   write(*,'(a,*(3f12.3," |"))') 'x = ', (x(i)%vec, i=1,ubound(x,1))
end subroutine qv

end module mod



program noncontiguous

use mod
implicit none

integer :: k
type(t), dimension(1:2) :: a

do k = 1,2
   a(k)%i = k
   a(k)%v%vec = [real(k)+1.0, real(k)+2.0, real(k)+3.0]
end do

call qv(a%v)

end program noncontiguous


More information about the Gcc-bugs mailing list