https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78935
Bug ID: 78935 Summary: ICE on allocating derived type coarray with allocatable components Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: damian at sourceryinstitute dot org Target Milestone: --- As shown below, a trunk build dated 20161224 reports an internal compiler error with an array allocation statement in the same scope as the allocation of a coarray with allocatable components. No ICE occurs when (1) the two modules are concatenated into one file or (2) the USE statement is moved into the subroutine or (3) the order of the allocate statements is reverse or (4) the USE statement is moved into the subroutine. Because this is a greatly reduced bug reproducer from an OpenCoarrays user, I don't know which of the workarounds is feasible or will work in the full application setting. $ gfortran --version GNU Fortran (GCC) 7.0.0 20161224 (experimental) $ cat declarations.f90 module DECLARATIONS type EXCHANGE_BOUNDHI real,allocatable::NORMALS(:) end type type(EXCHANGE_BOUNDHI),allocatable::IEXBOUNDHISI[:] real, allocatable :: x(:) end module $ cat communications.f90 USE DECLARATIONS contains SUBROUTINE EXHBOUNDHIGHER2() allocate(x(1)) allocate(IEXBOUNDHISI[*]) END SUBROUTINE END $ gfortran -fcoarray=lib -c declarations.f90 communications.f90 communications.f90:5:0: allocate(IEXBOUNDHISI[*]) internal compiler error: in gfc_conv_descriptor_token, at fortran/trans-array.c:305 0x6faa1d gfc_conv_descriptor_token(tree_node*) /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-array.c:303 0x73ae88 gfc_trans_structure_assign(tree_node*, gfc_expr*, bool, bool) /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-expr.c:7534 0x73bc32 gfc_conv_structure(gfc_se*, gfc_expr*, int) /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-expr.c:7651 0x73425c gfc_conv_expr(gfc_se*, gfc_expr*) /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-expr.c:7818 0x73db75 gfc_trans_assignment_1 /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-expr.c:9877 0x781b59 gfc_trans_allocate(gfc_code*) /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:6293 0x6f3557 trans_code /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:1966 0x7245f8 gfc_generate_function_code(gfc_namespace*) /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-decl.c:6285 0x7242ec gfc_generate_contained_functions /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-decl.c:5280 0x7242ec gfc_generate_function_code(gfc_namespace*) /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-decl.c:6214 0x6abf76 translate_all_program_units /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/parse.c:6008 0x6abf76 gfc_parse_file() /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/parse.c:6208 0x6ef672 gfc_be_parse_file /home/rouson/Desktop/Builds/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/f95-lang.c:202 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.