This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch,gfortran] PR 23843: IO on derived types with PRIVATE components


:ADDPATCH fortran:

Here is a patch for PR 23843.

Currently we reject code like

------------------
module gfortran2
    type tp
        private
        integer :: i
    end type
contains
    subroutine test(x)
        type(tp), intent(in) :: x
        write(*,*) x
    end subroutine test
end module
------------------

with the error message

        write(*,*) x
                   1
    Error: Data transfer element at (1) cannot have PRIVATE components

This is because, in resolve.c/resolve_transfer() we only check if
the type to be transferred has private components, but not if it
is defined in the same module.  To fix the problem, I added a check to
see if the type is use associated.

Bubblestrapped and reg.tested on mainline & 4.0, Linux/x86.
Please commit if OK.


2005-09-21  Erik Edelmann  <erik.edelmann@iki.fi>

        PR fortran/23843
        * resolve.c (resolve_transfer): For types with PRIVATE
          components, also check if the type is use associated.


2005-09-21  Erik Edelmann  <erik.edelmann@iki.fi>

        PR fortran/23843
        * gfortran.dg/der_io_2.f90: New test.



        Erik

Attachment: 23843.diff
Description: Text document

Attachment: der_io_2.f90
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]