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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot 
gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #9 from anlauf at gcc dot gnu.org ---
(In reply to Steve Kargl from comment #8)
> I think TRANSFER needs to be handled differently.
> 
> From the same section of the Fortran standard, TRANSFER is
> rejected if the following does not apply.
> 
>    (8) a reference to the intrinsic function TRANSFER where each
>    argument is a constant expression and each ultimate pointer
>    component of the SOURCE argument is disassociated,

yeah, I did that for the final patch.  Will submit soon.

> So, one should be able to do something like
> 
>    integer,parameter :: n = 4
>    integer,parameter :: x(transfer(n, n)) = 1
>    print *, x
>    end
> 
> which gfortran will give 
> 
> % gfortran10 -o z a.f90
> % ./z
>            1           1           1           1

This is less of an issue.  We also currently fail on the following:

subroutine s4
  integer, parameter :: n = 4
  integer, parameter :: x(transfer(n, n)) = 1 ! legal
  integer            :: y(transfer(n, n)) = 2 ! legal
  integer, parameter :: k = size (x) ! ok
  integer, parameter :: m = size (y) ! fails, tracked separately
  print *, k, x, y
  if (k /= size (y)) stop 1
end

For some reason we do not simplify SIZE(y), and this reason lies elsewhere.
And it is not touch by my patch.

> If you remove TRANSFER from the patch, it looks good to me.
> We can revisit TRANSFER when Gerhard breaks gfortran, again! ;-)

I'll bet he does, but don't hold your breath?

Reply via email to