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

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Created attachment 42743 [details]
> A fix for the problem
>
> With the attached patch, now produces the error:

The patch works as expected.

> Error: The object ‘x’ at (1) has a deferred LEN parameter ‘b’ and
> is neither allocatable nor a pointer
>
> Giving x either attribute allows compilation and correct execution.
> (I assume that x%a, being a KIND parameter, is OK in a KIND specification?

I see something strange with/without the patch:

program p
   type t(a, b)
      integer, kind :: a
      integer, len :: b
      real(a) :: r(b)
   end type
   type(t(8, 10)) :: x
   real(x%a) :: y
   print *, kind(x%r), kind(y)
end

prints

           8           8

while

program p
   type t(a, b)
      integer, kind :: a
      integer, len :: b
      real(a) :: r(b)
   end type
   type(t(8, :)), allocatable :: x
   real(x%a) :: y
   print *, kind(x%a), kind(y)
end

prints

           4           8

In addition with the last test, I did not find a way to do any allocation.

Reply via email to