https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69870
Bug ID: 69870 Summary: ICE while detecting undeclared parameter Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: jwmwalrus at gmail dot com Target Milestone: --- Hi. The (invalid) code below throws an ICE with both gfortran 5 and 6. ----- module somemod implicit none contains subroutine output() character(STRING_TEXT) :: msg end subroutine end module somemod ----- With gfortran 5 I get: ~$ gfortran-5 -c somemod.f90 somemod.f90:4:0: subroutine output() 1 internal compiler error: in gfc_typenode_for_spec, at fortran/trans-types.c:1084 0x683cc8 gfc_typenode_for_spec(gfc_typespec*) ../../src/gcc/fortran/trans-types.c:1084 0x683cc8 gfc_sym_type(gfc_symbol*) ../../src/gcc/fortran/trans-types.c:2170 0xd4f548 gfc_get_symbol_decl(gfc_symbol*) ../../src/gcc/fortran/trans-decl.c:1511 0xd4e482 generate_local_decl ../../src/gcc/fortran/trans-decl.c:5055 0x64bce2 expr_decls ../../src/gcc/fortran/trans-decl.c:5003 0x5c4294 gfc_traverse_expr(gfc_expr*, gfc_symbol*, bool (*)(gfc_expr*, gfc_symbol*, int*), int) ../../src/gcc/fortran/expr.c:4161 0x645a0b generate_expr_decls ../../src/gcc/fortran/trans-decl.c:5010 0x645a0b generate_dependency_declarations ../../src/gcc/fortran/trans-decl.c:5025 0x645a0b generate_local_decl ../../src/gcc/fortran/trans-decl.c:5052 0xd4405e do_traverse_symtree ../../src/gcc/fortran/symbol.c:3646 0xd4ce0b generate_local_vars ../../src/gcc/fortran/trans-decl.c:5245 0xd4ce0b gfc_generate_function_code(gfc_namespace*) ../../src/gcc/fortran/trans-decl.c:5781 0x62dd77 gfc_generate_module_code(gfc_namespace*) ../../src/gcc/fortran/trans.c:2072 0xd2afea translate_all_program_units ../../src/gcc/fortran/parse.c:5330 0xd2afea gfc_parse_file() ../../src/gcc/fortran/parse.c:5540 0x11e9fa5 gfc_be_parse_file ../../src/gcc/fortran/f95-lang.c:229 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions. With gfortran 6 I get: ~$ gfortran-6 -c somemod.f90 somemod.f90:4:0: subroutine output() internal compiler error: in gfc_typenode_for_spec, at fortran/trans-types.c:1064 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions. Ironically, removing the "implicit none" line shows the actual issue ---since STRING_TEXT becomes an implicitly REAL parameter/expression. System and compiler information follows: ~$ lsb_release -rd && gfortran-5 -v && gfortran-6 -v Description: Debian GNU/Linux testing-updates (sid) Release: testing-updates Using built-in specs. COLLECT_GCC=gfortran-5 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 5.3.1-8' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --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 5.3.1 20160205 (Debian 5.3.1-8) Using built-in specs. COLLECT_GCC=gfortran-6 COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/6.0.0/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 20160125-1' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs --enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++ --prefix=/usr/lib/gcc-snapshot --enable-shared --enable-linker-build-id --disable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-snap-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-snap-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-snap-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --disable-werror --enable-checking=yes --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 6.0.0 20160125 (experimental) [trunk revision 232803] (Debian 20160125-1)