This is the mail archive of the gcc-bugs@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]

[Bug fortran/23843] New: Access restrictions on derived types in modules too strict.


The following code:

---------------------------
module gfortran2

    type tp
        private
        integer :: i
    end type
contains
    subroutine inittp(X)
        type(tp), intent(inout) :: X
        X%i = 256
    end subroutine inittp

    subroutine test(x)
        type(tp), intent(in) :: x

        write(*,*) x%i
        write(*,*) x
    end subroutine test
end module

program prog
    use gfortran2
    implicit none
    type(tp) :: Y

    call inittp(Y)
    call test(Y)
end program prog
--------------------------

produces the following error:

--------------------------
> gfortran-CVS gfortran2.F95  -Wall
 In file gfortran2.F95:17

        write(*,*) x
                   1
Error: Data transfer element at (1) cannot have PRIVATE components
 In file gfortran2.F95:22

    use gfortran2
                1
Fatal Error: Can't open module file 'gfortran2.mod' for reading at (1): No such
file or directory
---------------------------

The second error is a direct result of the first.  The code is accepted without
error or warning by Intel, NAG, and XLF compilers, even with -std95 and -warn all.

Thanks,
Erik

P.S.  I'm not a standards lawyer, so the above code may not be valid, but it
does work on the other compilers.

P.P.S.  Thanks for all the great work on this project.

-- 
           Summary: Access restrictions on derived types in modules too
                    strict.
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zeekec at mad dot scientist dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23843


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