[Bug fortran/82168] New: Parameterized Derived Types, problems with default type parameters

physiker at toast2 dot net gcc-bugzilla@gcc.gnu.org
Sun Sep 10 19:22:00 GMT 2017


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

            Bug ID: 82168
           Summary: Parameterized Derived Types, problems with default
                    type parameters
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: physiker at toast2 dot net
  Target Milestone: ---

The following code is rejected by gcc-8. According to page 258 of modern
fortran explained default type parameters are allowed. Therefore, I assume the
following    code bug2.f90 ist legal.

cat bug2.f90

module mod
implicit none

integer, parameter :: dp = kind (0.0d0)

type, public :: v(z, k)
   integer, len :: z
   integer, kind :: k = kind(0.0)
   real(kind = k) :: e(z)
end type v

end module mod

program bug
use mod
implicit none

type (v(2)) :: a
type (v(z=:, k=dp)), allocatable :: b

end program bug

LANG=C gfortran-8 -v -W -Wall bug2.f90
Driving: gfortran-8 -v -W -Wall bug2.f90 -mmacosx-version-min=10.11.6
-asm_macosx_version_min=10.11 -l gfortran -shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran-8
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/8.0.0/lto-wrapper
Target: x86_64-apple-darwin15.6.0
Configured with: ../gcc/configure --enable-languages=c,c++,fortran,lto
--with-gmp=/sw --with-libiconv-prefix=/sw --with-isl=/sw --with-mpc=/sw
--with-system-zlib --program-suffix=-8
Thread model: posix
gcc version 8.0.0 20170910 (experimental) [trunk revision 251945] (GCC) 
COLLECT_GCC_OPTIONS='-v' '-Wextra' '-Wall' '-mmacosx-version-min=10.11.6'
'-asm_macosx_version_min=10.11' '-shared-libgcc' '-mtune=core2'
 /usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/8.0.0/f951 bug2.f90 -fPIC
-quiet -dumpbase bug2.f90 -mmacosx-version-min=10.11.6 -mtune=core2 -auxbase
bug2 -Wextra -Wall -version -fintrinsic-modules-path
/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/8.0.0/finclude -o
/var/folders/97/4qnhjhtn25s86s9hkz0h37_m0000gn/T//cc0hzKu0.s
GNU Fortran (GCC) version 8.0.0 20170910 (experimental) [trunk revision 251945]
(x86_64-apple-darwin15.6.0)
        compiled by GNU C version 8.0.0 20170910 (experimental) [trunk revision
251945], GMP version 6.1.2, MPFR version 3.1.5, MPC version 1.0.3, isl version
isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran2008 (GCC) version 8.0.0 20170910 (experimental) [trunk revision
251945] (x86_64-apple-darwin15.6.0)
        compiled by GNU C version 8.0.0 20170910 (experimental) [trunk revision
251945], GMP version 6.1.2, MPFR version 3.1.5, MPC version 1.0.3, isl version
isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
bug2.f90:18:11:

 type (v(2)) :: a
           1
Error: The value for the KIND parameter ''k'' at (1) does not reduce to a
constant expression
bug2.f90:19:9:

 type (v(z=:, k=dp)), allocatable :: b
         1
Error: Syntax error in argument list at (1)


More information about the Gcc-bugs mailing list