https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85541
Bug ID: 85541 Summary: ICE with parameterized derived type (PDT) and allocate Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: w6ws at earthlink dot net Target Milestone: --- The following test case causes an ICE when the allocate statement is present. This was first noticed with an older development snapshot. However I updated my compiler to a snapshot of todays trunk and still shows the problem. wws@w6ws-4:/rootsda5/home/wws/fortran/pdt$ cat charptr.f90 module char_kinds implicit none type charptr(clen) integer, len :: clen character(clen), pointer :: cptr(:) => null() end type end module program charptr_test use char_kinds implicit none type (charptr(clen=:)), allocatable :: mychars allocate (mychars) ! ICEes with this, compiles without it end program wws@w6ws-4:/rootsda5/home/wws/fortran/pdt$ /usr/local/gcc-trunk/bin/gfortran --version GNU Fortran (GCC) 9.0.0 20180426 (experimental) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. wws@w6ws-4:/rootsda5/home/wws/fortran/pdt$ /usr/local/gcc-trunk/bin/gfortran -c charptr.f90 charptr.f90:17:0: allocate (mychars) internal compiler error: Segmentation fault 0xce260f crash_signal ../../gcc-trunk/gcc/toplev.c:325 0x693b2c insert_parameter_exprs ../../gcc-trunk/gcc/fortran/decl.c:3337 0x6b1390 gfc_traverse_expr(gfc_expr*, gfc_symbol*, bool (*)(gfc_expr*, gfc_symbol*, int*), int) ../../gcc-trunk/gcc/fortran/expr.c:4731 0x76e145 structure_alloc_comps ../../gcc-trunk/gcc/fortran/trans-array.c:9054 0x772850 gfc_allocate_pdt_comp(gfc_symbol*, tree_node*, int, gfc_actual_arglist*) ../../gcc-trunk/gcc/fortran/trans-array.c:9391 0x7ea98a gfc_trans_allocate(gfc_code*) ../../gcc-trunk/gcc/fortran/trans-stmt.c:6604 0x7542b7 trans_code ../../gcc-trunk/gcc/fortran/trans.c:1996 0x788f45 gfc_generate_function_code(gfc_namespace*) ../../gcc-trunk/gcc/fortran/trans-decl.c:6507 0x7081d0 translate_all_program_units ../../gcc-trunk/gcc/fortran/parse.c:6121 0x7081d0 gfc_parse_file() ../../gcc-trunk/gcc/fortran/parse.c:6324 0x75107f gfc_be_parse_file ../../gcc-trunk/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. wws@w6ws-4:/rootsda5/home/wws/fortran/pdt$