Bug 41489 - PUBLIC - PRIVATE conflict
Summary: PUBLIC - PRIVATE conflict
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-28 13:43 UTC by ros
Modified: 2009-09-28 20:02 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ros 2009-09-28 13:43:20 UTC
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
Comment 1 kargls 2009-09-28 14:01:05 UTC
The code compiles with 

gcc version 4.4.2 20090924
gcc version 4.5.0 20090918

Please upgrade your compiler to a newer version because it is
unlikely that the patch will be backported to the 4.3 branch.
Comment 2 ros 2009-09-28 14:58:18 UTC
Subject: Re:  PUBLIC - PRIVATE conflict

I'm sorry.  The error message disapeared when using gfortran 4.5 !
So my bug report is obsolete.


+----------------------------------------------------------------------+
|  Roland Schilling                      Home-Office: +49(89)32929-670 |
|  Max-Planck-Institut für Gravitationsphysik                          |
|  -- Albert-Einstein-Institut --                                      |
|  D-85748 Garching                           E-mail:   ros@rzg.mpg.de |
|  Germany                                  http://www.aei-hannover.de |
+----------------------------------------------------------------------+
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
Comment 3 Tobias Burnus 2009-09-28 20:02:15 UTC
For completeness: I think it was fixed as part of PR 39800.

> The compile command simply was 'gfortran -c bug2.f90'.
> gcc -v  gives

You should have used "gfortran -v" instead. The "3.3.4" output won't help as gfortran is only since 4.0.0 part of GCC; thus "gcc version 4.3.1 leads to the same error message" presumably means that gfortran comes from 4.3.1 and the same "gfortran" binary is called in either case.


> I'm sorry.  The error message disapeared when using gfortran 4.5 !
> So my bug report is obsolete.

No problem - better one bugreport too much than having no bugreport for a still existing bug. Therefore: Thanks for reporting it.