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

            Bug ID: 82205
           Summary: parametrized derived types, problems with
                    initialization
           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: ---

gfortran-8 rejects the code bug3.f90. I believe it is legal, though. ifort
version 17 compiles the code without a warning. The executable prints the
expected output, when run.

bug3.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

integer :: i
type (v(2)) :: a
type (v(z=:, k=dp)), allocatable :: b
real :: c(2) = [ (1.5*i, i=1,size(c)) ]
a = v(2)(c)
b = v(2,dp)(c)

print *, size(a%e), a%k
print *, size(b%e), b%k
end program bug

LANG=C gfortran-8 -v -o bug3 bug3.f90 -W -Wall
Driving: gfortran-8 -v -o bug3 bug3.f90 -W -Wall -mmacosx-version-min=10.11.0
-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 20170912 (experimental) [trunk revision 252040] (GCC) 
COLLECT_GCC_OPTIONS='-v' '-o' 'bug3' '-Wextra' '-Wall'
'-mmacosx-version-min=10.11.0' '-asm_macosx_version_min=10.11' '-shared-libgcc'
'-mtune=core2'
 /usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/8.0.0/f951 bug3.f90 -fPIC
-quiet -dumpbase bug3.f90 -mmacosx-version-min=10.11.0 -mtune=core2 -auxbase
bug3 -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//cc8Do2wy.s
GNU Fortran (GCC) version 8.0.0 20170912 (experimental) [trunk revision 252040]
(x86_64-apple-darwin15.6.0)
        compiled by GNU C version 8.0.0 20170912 (experimental) [trunk revision
252040], GMP version 6.1.2, MPFR version 3.1.6, 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 20170912 (experimental) [trunk revision
252040] (x86_64-apple-darwin15.6.0)
        compiled by GNU C version 8.0.0 20170912 (experimental) [trunk revision
252040], GMP version 6.1.2, MPFR version 3.1.6, MPC version 1.0.3, isl version
isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
bug3.f90:22:7:

 a = v(2)(c)
       1
Error: Invalid character in name at (1)
bug3.f90:23:7:

 b = v(2,dp)(c)
       1
Error: Invalid character in name at (1)

~$ ifort -v
ifort version 17.0.0
~$ ifort -warn all -standardsemantics -o bug3 bug3.f90
~$ ./bug3
           2           4
           2           8

Reply via email to