https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78990
Bug ID: 78990 Summary: ICE when assigning polymorphic array function result Product: gcc Version: 6.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: cmacmackin at gmail dot com Target Milestone: --- Created attachment 40459 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40459&action=edit Minimal reproducer When a function returns a polymorphic array which is to be assigned to a local array (via defined assignment), gfortran experiences a segfault. I've attached a minimal example, which produces an ICE in gfortran 6.2.0 and 5.4.1 (both from the Ubuntu 16.04 repos, the former from the ubuntu-toolchain-r/test PPA). The error message is as follows: minimal.f90:36:0: v3 = return_t1(v1) internal compiler error: Segmentation fault 0xa71b9f crash_signal ../../src/gcc/toplev.c:333 0x696d84 gfc_conv_array_stride(tree_node*, int) ../../src/gcc/fortran/trans-array.c:2776 0x696d84 gfc_trans_preloop_setup ../../src/gcc/fortran/trans-array.c:3528 0x69793a gfc_start_scalarized_body(gfc_loopinfo*, stmtblock_t*) ../../src/gcc/fortran/trans-array.c:3586 0x6ed5cf gfc_trans_call(gfc_code*, bool, tree_node*, tree_node*, bool) ../../src/gcc/fortran/trans-stmt.c:476 0x68ef73 trans_code ../../src/gcc/fortran/trans.c:1768 0x6b25dc gfc_generate_function_code(gfc_namespace*) ../../src/gcc/fortran/trans-decl.c:6167 0x64a800 translate_all_program_units ../../src/gcc/fortran/parse.c:5915 0x64a800 gfc_parse_file() ../../src/gcc/fortran/parse.c:6121 0x68c1c2 gfc_be_parse_file ../../src/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 <file:///usr/share/doc/gcc-6/README.Bugs> for instructions. Note that I'm not 100% certain that this is legal code (I don't have access to any other compilers to check).