https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86587

            Bug ID: 86587
           Summary: Derived-type with attributes BIND(C) and PRIVATE
                    raises an error but standard accepts it
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: valentin.clement at env dot ethz.ch
  Target Milestone: ---

Created attachment 44409
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44409&action=edit
Code

The following code is rejected by gfortran but according to the standard it
should be accepted. Cray and PGI Compiler seems to accept this combination of
attributes.

MODULE mod1
  USE ISO_C_BINDING
  TYPE, BIND(C), PRIVATE :: myType
    INTEGER(C_INT) :: i1, i2
  END TYPE
END MODULE mod1

If the PRIVATE is global to the module, the code is fine. 

MODULE mod1
  USE ISO_C_BINDING
  PRIVATE
  TYPE, BIND(C) :: myType
    INTEGER(C_INT) :: i1, i2
  END TYPE
END MODULE mod1

Compilation: 
gfortran-8 -c file.f90

gfortran version: 
Using built-in specs.
COLLECT_GCC=gfortran-8
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/8.1.0/libexec/gcc/x86_64-apple-darwin17.5.0/8.1.0/lto-wrapper
Target: x86_64-apple-darwin17.5.0
Configured with: ../configure --build=x86_64-apple-darwin17.5.0
--prefix=/usr/local/Cellar/gcc/8.1.0
--libdir=/usr/local/Cellar/gcc/8.1.0/lib/gcc/8
--enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-8
--with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr
--with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl
--with-system-zlib --enable-checking=release --with-pkgversion='Homebrew GCC
8.1.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--disable-nls
Thread model: posix
gcc version 8.1.0 (Homebrew GCC 8.1.0) 

machine: 
MacBook Pro (Retina, 13-inch, Early 2015), 2.9 GHz Intel Core i5, 8 GB 1867 MHz
DDR3

Reply via email to