https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68544
Bug ID: 68544 Summary: ICE trying to pass derived type constructor as a function Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: jim.macarthur at codethink dot co.uk Target Milestone: --- Created attachment 36839 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36839&action=edit Minimal test case The attached code causes an internal compiler error with the latest source from git master (commit 9c822ac) and 5.2.0. It attempts to pass the implicit constructor for a derived type as an argument to a subroutine. I don't know if this is valid code. I haven't found anything in the standards which suggest either way yet. Sun's F90 compiler rejects it, but gives a useful error message. gfortran -v: Using built-in specs. COLLECT_GCC=/home/jimmacarthur/gcc-5.2.0/gccinstall/bin/gfortran COLLECT_LTO_WRAPPER=/home/jimmacarthur/gcc-5.2.0/gccinstall/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-5.2.0/configure --with-languages=fortran --prefix=/home/jimmacarthur/gcc-5.2.0/gccinstall --disable-bootstrap Thread model: posix gcc version 5.2.0 (GCC) Compiler command line: ~/gcc-5.2.0/gccinstall/bin/gfortran -Wall -Wextra pass-type-constructor-as-function.f output: pass-type-constructor-as-function.f:1:23: SUBROUTINE sub (f) 1 Warning: Unused dummy argument âfâ at (1) [-Wunused-dummy-argument] pass-type-constructor-as-function.f:7:0: TYPE t 1 internal compiler error: Segmentation fault 0xa20cdf crash_signal ../../gcc-5.2.0/gcc/toplev.c:383 0x67b990 gfc_sym_identifier ../../gcc-5.2.0/gcc/fortran/trans-decl.c:347 0x67c38a build_function_decl ../../gcc-5.2.0/gcc/fortran/trans-decl.c:2057 0x682fa5 gfc_get_symbol_decl(gfc_symbol*) ../../gcc-5.2.0/gcc/fortran/trans-decl.c:1487 0x693537 gfc_conv_variable ../../gcc-5.2.0/gcc/fortran/trans-expr.c:2312 0x690c8a gfc_conv_expr(gfc_se*, gfc_expr*) ../../gcc-5.2.0/gcc/fortran/trans-expr.c:7219 0x696048 gfc_conv_expr_reference(gfc_se*, gfc_expr*) ../../gcc-5.2.0/gcc/fortran/trans-expr.c:7319 0x68d3ff gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*, gfc_expr*, vec<tree_node*, va_gc, vl_embed>*) ../../gcc-5.2.0/gcc/fortran/trans-expr.c:4831 0x6be024 gfc_trans_call(gfc_code*, bool, tree_node*, tree_node*, bool) ../../gcc-5.2.0/gcc/fortran/trans-stmt.c:419 0x66539c trans_code ../../gcc-5.2.0/gcc/fortran/trans.c:1743 0x685e54 gfc_generate_function_code(gfc_namespace*) ../../gcc-5.2.0/gcc/fortran/trans-decl.c:5841 0x622648 translate_all_program_units ../../gcc-5.2.0/gcc/fortran/parse.c:5340 0x622648 gfc_parse_file() ../../gcc-5.2.0/gcc/fortran/parse.c:5537 0x6613e5 gfc_be_parse_file ../../gcc-5.2.0/gcc/fortran/f95-lang.c:229