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

anlauf at gcc dot gnu.org changed:

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

--- Comment #8 from anlauf at gcc dot gnu.org ---
(In reply to Paul Thomas from comment #7)
> (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?

I don't see what it is not conforming.

Also Nvidia and AMD flang accept it and work as expected.

Reply via email to