https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70244
--- Comment #4 from simon at whiteowl dot co.uk --- I have the same problem but with a much smaller test case (attached above): /usr/local/bin/gfortran -c planets.f90 -v Using built-in specs. COLLECT_GCC=/usr/local/bin/gfortran Target: x86_64-pc-linux-gnu Configured with: ./configure Thread model: posix gcc version 8.1.0 (GCC) COLLECT_GCC_OPTIONS='-c' '-v' '-mtune=generic' '-march=x86-64' /usr/local/libexec/gcc/x86_64-pc-linux-gnu/8.1.0/f951 planets.f90 -quiet -dumpbase planets.f90 -mtune=generic -march=x86-64 -auxbase planets -version -fintrinsic-modules-path /usr/local/lib/gcc/x86_64-pc-linux-gnu/8.1.0/finclude -o /tmp/ccy3mnd3.s GNU Fortran (GCC) version 8.1.0 (x86_64-pc-linux-gnu) compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 3.1.5, MPC version 1.0.3, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU Fortran2008 (GCC) version 8.1.0 (x86_64-pc-linux-gnu) compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 3.1.5, MPC version 1.0.3, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 f951: internal compiler error: spec_dimen_size(): Bad dimension 0x5f22af gfc_internal_error(char const*, ...) ../.././gcc/fortran/error.c:1358 0x5c583b spec_dimen_size(gfc_array_spec*, int, __mpz_struct (*) [1]) ../.././gcc/fortran/array.c:2174 0x656736 expression_shape ../.././gcc/fortran/resolve.c:5088 0x656736 expression_rank(gfc_expr*) ../.././gcc/fortran/resolve.c:5168 0x66323c resolve_variable ../.././gcc/fortran/resolve.c:5575 0x66323c gfc_resolve_expr(gfc_expr*) ../.././gcc/fortran/resolve.c:6721 0x659da2 gfc_resolve_code(gfc_code*, gfc_namespace*) ../.././gcc/fortran/resolve.c:11094 0x65cedf resolve_codes ../.././gcc/fortran/resolve.c:16535 0x65cfae gfc_resolve(gfc_namespace*) ../.././gcc/fortran/resolve.c:16570 0x64ae00 resolve_all_program_units ../.././gcc/fortran/parse.c:6060 0x64ae00 gfc_parse_file() ../.././gcc/fortran/parse.c:6310 0x69130f gfc_be_parse_file ../.././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.