https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71807
Bug ID: 71807 Summary: Internal compiler error with NULL() reference in structure constructor Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: ian_harvey at bigpond dot com Target Milestone: --- The following snippet, when compiled with gfortran recent trunk (r238061) or 6.1.1 results in an internal compiler error. ~~ MODULE fold_convert_loc_ice IMPLICIT NONE PRIVATE TYPE, PUBLIC :: ta PRIVATE INTEGER :: a_comp END TYPE ta TYPE, PUBLIC :: tb TYPE(ta), ALLOCATABLE :: b_comp END TYPE tb CONTAINS SUBROUTINE proc TYPE(tb) :: b b = tb(null()) END SUBROUTINE proc END MODULE fold_convert_loc_ice ~~ $ gfortran -c -v fold_convert_loc_ice.f90 Using built-in specs. COLLECT_GCC=gfortran Target: x86_64-pc-linux-gnu Configured with: .././src/configure --prefix=/home/MEGMS2/ian/usr/gcc-7.0.0 --enable-languages=c,c++,fortran --enable-libgomp --enable-checking=release Thread model: posix gcc version 7.0.0 20160706 (experimental) (GCC) COLLECT_GCC_OPTIONS='-c' '-v' '-mtune=generic' '-march=x86-64' /home/MEGMS2/ian/usr/gcc-7.0.0/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/f951 fold_convert_loc_ice.f90 -quiet -dumpbase fold_convert_loc_ice.f90 -mtune=generic -march=x86-64 -auxbase fold_convert_loc_ice -version -fintrinsic-modules-path /home/MEGMS2/ian/usr/gcc-7.0.0/lib/gcc/x86_64-pc-linux-gnu/7.0.0/finclude -o /tmp/cc3kuTzv.s GNU Fortran (GCC) version 7.0.0 20160706 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 7.0.0 20160704 (experimental), GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.2, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU Fortran2008 (GCC) version 7.0.0 20160706 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 7.0.0 20160704 (experimental), GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.2, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 fold_convert_loc_ice.f90:17:0: b = tb(null()) internal compiler error: in fold_convert_loc, at fold-const.c:2371 0x833153 fold_convert_loc(unsigned int, tree_node*, tree_node*) ../.././src/gcc/fold-const.c:2371 0x6b6e27 gfc_trans_subcomponent_assign ../.././src/gcc/fortran/trans-expr.c:7250 0x6b6653 gfc_trans_structure_assign(tree_node*, gfc_expr*, bool) ../.././src/gcc/fortran/trans-expr.c:7391 0x6b7dbf gfc_conv_structure(gfc_se*, gfc_expr*, int) ../.././src/gcc/fortran/trans-expr.c:7420 0x6b8e62 gfc_trans_assignment_1 ../.././src/gcc/fortran/trans-expr.c:9317 0x682275 trans_code ../.././src/gcc/fortran/trans.c:1678 0x6a6019 gfc_generate_function_code(gfc_namespace*) ../.././src/gcc/fortran/trans-decl.c:6202 0x685a39 gfc_generate_module_code(gfc_namespace*) ../.././src/gcc/fortran/trans.c:2056 0x63d2eb translate_all_program_units ../.././src/gcc/fortran/parse.c:5873 0x63d2eb gfc_parse_file() ../.././src/gcc/fortran/parse.c:6092 0x67ec62 gfc_be_parse_file ../.././src/gcc/fortran/f95-lang.c:198 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.