Gfortran fails to compile the module bug2.f90 with the following error message:

bug2.f90:18.4:

    Function REACT ()
   1
Error: PUBLIC function 'react' at (1) cannot be of PRIVATE type 'aoi'

The compile command simply was 'gfortran -c bug2.f90'.

gcc -v  gives:
Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.4/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada
--disable-checking --libdir=/usr/lib --enable-libgcj
--with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib
--enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.4 (pre 3.3.5 20040809)
(gcc version 4.3.1 leads to the same error message.)

uname -a  gives:
Linux roshome 2.6.8-24.10-default #1 Wed Dec 22 11:54:27 UTC 2004 i686 i686
i386 GNU/Linux

Here comes the test module 'bug2.f90':
  MODULE OPTOCAD
!
    private
    public oc_trace
!
    type :: aoi
      character         :: a=''        ! action
      integer           :: o=0         ! diffraction order
      integer           :: i=0         ! index of incidence angle
    end type aoi
!
  CONTAINS
!----------------------------------------------------------------------------!
    Subroutine OC_TRACE
!
    contains
   !-------------------------------------------------------------------------!
    Function REACT ()
!
    type(aoi)                :: react
!
    return
    end function REACT
   !-------------------------------------------------------------------------!
    end subroutine OC_TRACE
!----------------------------------------------------------------------------!
  END MODULE OPTOCAD


-- 
           Summary: PUBLIC - PRIVATE comflict
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ros at rzg dot mpg dot de


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

Reply via email to