https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71730
Bug ID: 71730 Summary: ICE when character length specification uses an undefined variable Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: bardeau at iram dot fr Target Milestone: --- Hi, the following code raises an ICE. The error was seen with gfortran 5.3.0 and 6.1.0. Cheers $ cat ice.f90 subroutine foo implicit none character(len=bar) :: a end subroutine foo $ gfortran ice.f90 ice.f90:1:0: subroutine foo internal compiler error: in gfc_typenode_for_spec, at fortran/trans-types.c:1064 0x6e981b gfc_typenode_for_spec(gfc_typespec*) ../../srcdir/gcc/fortran/trans-types.c:1064 0x6e9b0f gfc_sym_type(gfc_symbol*) ../../srcdir/gcc/fortran/trans-types.c:2160 0x69cf4c gfc_get_symbol_decl(gfc_symbol*) ../../srcdir/gcc/fortran/trans-decl.c:1574 0x69f907 generate_local_decl ../../srcdir/gcc/fortran/trans-decl.c:5220 0x69fcde expr_decls ../../srcdir/gcc/fortran/trans-decl.c:5168 0x5ee249 gfc_traverse_expr(gfc_expr*, gfc_symbol*, bool (*)(gfc_expr*, gfc_symbol*, int*), int) ../../srcdir/gcc/fortran/expr.c:4148 0x69fc10 generate_expr_decls ../../srcdir/gcc/fortran/trans-decl.c:5175 0x69fc10 generate_dependency_declarations ../../srcdir/gcc/fortran/trans-decl.c:5190 0x69fc10 generate_local_decl ../../srcdir/gcc/fortran/trans-decl.c:5217 0x6686bb do_traverse_symtree ../../srcdir/gcc/fortran/symbol.c:3817 0x6a053a generate_local_vars ../../srcdir/gcc/fortran/trans-decl.c:5410 0x6a053a gfc_generate_function_code(gfc_namespace*) ../../srcdir/gcc/fortran/trans-decl.c:6089 0x639430 translate_all_program_units ../../srcdir/gcc/fortran/parse.c:5613 0x639430 gfc_parse_file() ../../srcdir/gcc/fortran/parse.c:5819 0x67a5c5 gfc_be_parse_file ../../srcdir/gcc/fortran/f95-lang.c:201 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. $ gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/home/bardeau/Softs/gcc-6.1.0/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../srcdir/configure --with-gmp=/home/bardeau/Softs --prefix=/home/bardeau/Softs/gcc-6.1.0 --enable-languages=c,c++,fortran Thread model: posix gcc version 6.1.0 (GCC)