https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83319
Bug ID: 83319 Summary: [7/8 Regression] ICE on use of allocatable component in derived type coarray defined in module Product: gcc Version: 7.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: damian at sourceryinstitute dot org Target Milestone: --- Presumably the internal compiler error (ICE) demonstrated below is somehow related to the known regression in support for allocatable components in derived type coarrays, which is issue 422 on the OpenCoarrays repository. OpenCoarrays issue 422, however, generates a runtime error message inside the coarray ABI, whereas this issue generates a compile-time error message so it's a compiler-side problem. Also, OpenCoarrays issue 422 involves communication; whereas this is much more basic: the ICE appears when I do anything with the allocatable component so this is an even more serious regression on top of the already very serious regression described in issue 422. (Besides allocating the component as shown below, I also tried a source allocation and an assignment to it.) The ICE disappears if the derived type definition is moved into the main program. This is somewhat similar to PR 78935, but 78935 was fixed 11 months ago and this seems sufficiently different to warrant a separate PR rather than reopening 78935. This ICE occurs with today's 7 branch, with 7.2.0, and with the trunk dated 20170921. The code compiles cleanly with GCC 6.4.0. $ cat allocatable-component-of-dt-coarray.f90 module foo_module implicit none type foo integer, allocatable :: i(:) end type end module use foo_module implicit none type(foo), save :: bar[*] allocate(bar%i(1)) end $ gfortran -fcoarray=lib -c allocatable-component-of-dt-coarray.f90 allocatable-component-of-dt-coarray.f90:8:0: use foo_module internal compiler error: in gfc_conv_descriptor_token, at fortran/trans-array.c:305 0x6a9130 gfc_conv_descriptor_token(tree_node*) /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/gcc-7-branch/gcc/fortran/trans-array.c:303 0x6d6858 gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool) /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/gcc-7-branch/gcc/fortran/trans-expr.c:7567 0x6d0b47 gfc_conv_structure(gfc_se*, gfc_expr*, int) /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/gcc-7-branch/gcc/fortran/trans-expr.c:7686 0x6df17e gfc_trans_assignment_1 /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/gcc-7-branch/gcc/fortran/trans-expr.c:9984 0x6be5ff generate_coarray_sym_init /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/gcc-7-branch/gcc/fortran/trans-decl.c:5188 0x68dc72 do_traverse_symtree /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/gcc-7-branch/gcc/fortran/symbol.c:4009 0x6bdc95 generate_coarray_init /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/gcc-7-branch/gcc/fortran/trans-decl.c:5238 0x6c9954 gfc_generate_function_code(gfc_namespace*) /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/gcc-7-branch/gcc/fortran/trans-decl.c:6273 0x65b736 translate_all_program_units /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/gcc-7-branch/gcc/fortran/parse.c:6074 0x65b736 gfc_parse_file() /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/gcc-7-branch/gcc/fortran/parse.c:6274 0x69ff5f gfc_be_parse_file /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/gcc-7-branch/gcc/fortran/f95-lang.c:204 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. $ gfortran --version GNU Fortran (GCC) 7.2.1 20171208