https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128415
--- Comment #2 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #0)
> More exactly, the testcase combines item 1 first bullet and item 2 first
> bullet
And this variant combines item 1 second bullet and item2 first bullet:
program prog
implicit none
integer, parameter :: n = 5
type :: t1
integer :: c1, c2
end type
type(t1) :: a(n)
integer :: i
a = [ (t1(2*i*i+1, 3*i+2), i=1,n) ]
call sub(a)
contains
subroutine sub(x)
type(t1) :: x(n)
class(*), pointer :: p(:)
allocate(p, source=x%c1)
if (.not. is_contiguous(p)) error stop 1
end subroutine
end program
fails with trunk, works with 16.2.
item 1 second bullet is:
> - If the base array is an explicit-shape non-descriptor array
> (GFC_ARRAY_TYPE_P (TREE_TYPE (desc))), full is 0, but because
> subref_array_target is false, parmtype is computed as
> gfc_get_element_type (TREE_TYPE (desc)) (the parent array's element
> type, e.g., complex(4) or type(t) of size 8 instead of real(4) or
> integer(4) of size 4), and parm's dtype is set to
> gfc_get_dtype (parmtype).