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

           Summary: Unnecessary warning for private interfaces having the
                    BIND(C) attribute
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: jwmwal...@gmail.com


When the following module:

module mod1
    use iso_c_binding
    implicit none
    save

    interface
        function strerror(errnum) bind(C, NAME = 'strerror')
            import
            type(C_PTR) :: strerror
            integer(C_INT), value :: errnum
        end function
    end interface

    private strerror
end module mod1


gfortran warns about the private symbol 'strerror' being given a binding label.
 The exact warning is:

...:~$ gfortran -c  test_gfortran_private_cbinding.f90 
test_gfortran_private_cbinding.f90:8.8:

        function strerror(errnum) bind(C, NAME = 'strerror')
        1
Warning: Symbol 'strerror' at (1) is marked PRIVATE but has been given the
binding label 'strerror'


In sections 5.3.2 and 5.3.5 of the Fortran 2008 standard, there seems to be no
restriction between the BIND and PRIVATE attributes ---i.e., the BIND(C)
attribute is compatible with the PRIVATE attribute, and therefore no warning
should be issued by the gfortran.


The version information is:

...:~$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.6.0-3~ppa1'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-multiarch
--with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib/x86_64-linux-gnu
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --disable-werror
--with-arch-32=i686 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.1 20110409 (prerelease) (Ubuntu 4.6.0-3~ppa1) 


The system information (for Ubuntu 11.04) is:

...:~$ uname -srvmpio
Linux 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 x86_64
x86_64 x86_64 GNU/Linux

Reply via email to