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

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

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

--- Comment #9 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 44892
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44892&action=edit
Patch for the PR

With the attached patch, the test below works fine.

The patch needs a bit more work to prevent LEN and KIND part_exprs being
assigned to, to assert the relevant standards and to prevent inquiries about
unallocated or unassociated deferred length expressions.

Paul

module m
  complex, target :: z
  character (:), allocatable :: str
  real, pointer :: r => z%re
  real, pointer :: i => z%im
  type :: mytype
    complex :: z = ( 10.0, 11.0 )
    character(6) :: str
  end type
end module

  use m

  type(mytype) :: der
  integer :: j

  z = (2.0,4.0)
  str = "abcd"

  if (r .ne. real (z)) stop 1
  if (i .ne. imag (z)) stop 2

  z%im = 4.0 * z%re

  if (z%re .ne. real (z)) stop 3
  if (abs (z*im - 4.0 * real (z)) .lt. 1e-6) stop 4
  if (z%im%kind .ne. kind (z)) stop 5

  if (str%kind .ne. kind (str)) stop 6
  if (str%len .ne. len (str)) stop 6

  if (der%str%len .ne. len (der%str)) stop 7
  if (der%z%im .ne. imag (der%z)) stop 8
end

Reply via email to