https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93365
--- Comment #6 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- 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. > > 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.