https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93365
--- Comment #7 from markeggleston at gcc dot gnu.org --- (In reply to Steve Kargl from comment #6) > On Fri, Jan 24, 2020 at 12:36:45PM +0000, markeggleston at gcc dot gnu.org > wrote: > > gfc_simplify_expr calls simplify_parameter_variable which for zero size > > arrays it creates a new gfc_expr structure with the expr_type set to > > EXPR_ARRAY > > and replaces primary. When primary is replaced its chain of ref structures > > is > > deleted so tmp->u.i is invalid causing the ICE the following lines are never > > reached: > > The lines are reached in my debugging sessions. :-) > I bootstrap with --enable-checking, which might > prevent the ICE issue. Tried that to no effect, however, I found that the version of the compiler used to compile gfortran does affect the outcome: bootstrap no ICE gcc-8.2.0 no ICE gcc-6.3.0 ICE I haven't tried an other compilers. > > > > then enters the switch statement and get to lines 2384-2385 > > > > > > primary->ts.type = BT_INTEGER; > > > primary->ts.kind = gfc_default_integer_kind; > > > > > > This just resets a part of primary, but it does not fix up > > > it up correctly. Likely, need to check for zero size > > > arrays do extra work. > > > > I have modified gfc_simplify_expr: > > I'm beginning to think that calling gfc_simplify_expr may > not be correct, here. But, don't have time to investigate > more.