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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org

--- Comment #7 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to G. Steinmetz from comment #1)
> Compiles :

>       f%a => x

Yes, indeed. Also compiles if the t2 component, 'a' is allocatable.

program p
   type t
      integer :: i
   end type
   type t2
      type(t), pointer :: a(:) ! Works fine if allocatable
   end type
   class(t), allocatable :: a(:)
   class(t2), allocatable :: b

   a = [t(1), t(2)]
   b = f(a)
   print *, b%a
contains
   function f(x)
      class(t), intent(in), target :: x(:)
      type(t2) :: f
      allocate (f%a(size(x)))
      f%a = x
   end
end

fails in compilation of f%a = x with both gfortran and nagfor. ifort compiles
it and outputs expected result.

Although it looks OK to me, is it standard defying in any way?

Paul

Reply via email to