Created attachment 40450 [details] MCVE of CAF-DT with allocatable member My current "env" is + GNU Fortran (GCC) 7.0.0 20161206 (experimental) + MPICH 3.2.0 built with GCC 7.0.0 + OpenCoarrays built 1.7.5 with GCC 7.0.0 and MPICH 3.2.0 + Linux 4.8.8-2-ARCH #1 SMP PREEMPT Thu Nov 17 14:51:03 CET 2016 x86_64 GNU/Linux The MCVE raising the ICE is attached as "MCVE of CAF-DT with allocatable member". Essentially, there is a "base" DT (named "node") with an allocatable member, a second DT (named "caf") that has a coarray member of "type(node)". The last concrete instance of "type(caf)" is a scalar, static variable thus the code should be valid (while I still think that the other is invalid). Compiling this code with the above env generates the following ICE stefano@zaghi(09:38 AM Mon Dec 12) desk {opencoarrays-1.7.5-gnu-7.0.0 - OpenCoarrays 1.7.5 with gcc 7.0.0 environment} ~/fortran/compilers_bug/gfortran_sigsegv_caf_dt_allocatable_member 5 files, 84Kb → caf -fcoarray=lib sigsegv_caf_dt.f90 sigsegv_caf_dt.f90:77:0: end module caf_module internal compiler error: Segmentation fault 0xc0db4f crash_signal /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/toplev.c:333 0xeb1764 recompute_tree_invariant_for_addr_expr(tree_node*) /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/tree.c:4317 0xeb1d7c build1_stat(tree_code, tree_node*, tree_node*) /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/tree.c:4414 0x92c76c build1_stat_loc /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/tree.h:3903 0x92c76c fold_build1_stat_loc(unsigned int, tree_code, tree_node*, tree_node*) /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fold-const.c:12139 0x6f204f gfc_build_addr_expr(tree_node*, tree_node*) /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:298 0x70532b structure_alloc_comps /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-array.c:8329 0x7827b3 gfc_trans_deallocate(gfc_code*) /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:6477 0x6f1bf7 trans_code /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:1942 0x7742f3 gfc_trans_if_1 /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:1303 0x77c39a gfc_trans_if(gfc_code*) /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:1334 0x6f1ce7 trans_code /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:1878 0x7742f3 gfc_trans_if_1 /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:1303 0x77c39a gfc_trans_if(gfc_code*) /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:1334 0x6f1ce7 trans_code /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:1878 0x77e271 gfc_trans_simple_do /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:1924 0x77e271 gfc_trans_do(gfc_code*, tree_node*) /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:2057 0x6f1cba trans_code /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:1890 0x723038 gfc_generate_function_code(gfc_namespace*) /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-decl.c:6271 0x6f6949 gfc_generate_module_code(gfc_namespace*) /opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:2164 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. My best regards.
The code compiles with revision r242984 (2016-11-29), but gives an ICE with r243219, likely r243021. Note the code compiles with -fcoarray=single.
Well, this issue more difficult than it looks. I do not presume a solution will be ready for gcc 7.0. So I do not expect to hold the target milestone.
Here's a simpler demonstration of two problems this bug report identifies: module node_module implicit none type node integer, allocatable :: storage end type contains subroutine reallocate_node_storage(some_node) type(node) :: some_node allocate(some_node%storage) ! needs to generate a call to caf_register end subroutine end module module caf_module use node_module type caf type(node), allocatable :: array[:] end type contains subroutine allocate_storage(this) class(caf) :: this allocate(this%array[*]) !ICE: no token member initialized for node storage call reallocate_node_storage(this%array) end subroutine end module
GCC 7.1 has been released.
AFAICT this PR is fixed by the patch at https://gcc.gnu.org/ml/fortran/2017-12/msg00099.html.
Using 7.2, I still see an ICE with the reduced example from Comment 3: $ gfortran -fcoarray=lib -c bug-78983.f90 bug-78983.f90:24:0: end module internal compiler error: in gfc_conv_descriptor_data_get, at fortran/trans-array.c:144 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
> Using 7.2, I still see an ICE with the reduced example from Comment 3: You didn't apply Paul's patch at https://gcc.gnu.org/ml/fortran/2017-12/msg00099.html, did you? So why are you surprised that the PR isn't fixed? > AFAICT this PR is fixed by the patch at > https://gcc.gnu.org/ml/fortran/2017-12/msg00099.html. Tested on trunk (8.0) only.
GCC 7.3 is being released, adjusting target milestone.
This reads that this bug/regression has been fixed on version 8 (and therewith presumably 9), but just not backported to version 7. Correct? For the actual trunk and OpenCoarrays 2.1 everything works for me (compilation and execution).
I see no ICE in testing the code from Comment 3 using fortran 7.3.0, 8.2.0, and 9.0.1. I believe this can be closed.
> I see no ICE in testing the code from Comment 3 using fortran 7.3.0, > 8.2.0, and 9.0.1. Confirmed. > I believe this can be closed. Closing.