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

            Bug ID: 103154
           Summary: Crashing gfortran due to bad type parameter
                    specification
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: b.j.braams at cwi dot nl
  Target Milestone: ---

The following code is bad, it uses the undeclared variable k. This causes
gfortran to crash with an error message requesting the issue to be reported. I
obey.

Version information:
bash-5.0$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --with-isl --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.3.1 20210422 (Red Hat 10.3.1-1) (GCC) 

Command line invocation acting on file Test.f90
bash-5.0$ gfortran Test.f90

System response
internal compiler error: in gfc_typenode_for_spec, at
fortran/trans-types.c:1120
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

The file Test.f90 that triggers the internal error:
bash-5.0$ cat Test.f90
module Test
  implicit none
  type :: Test_Type (n)
     integer, len :: n
  end type Test_Type
contains
  subroutine Sub ()
    ! Crashing gfortran 9.3.1
    type (Test_Type(n=k)) :: foo
    return
  end subroutine Sub
end module Test

Reply via email to