https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86206
--- Comment #6 from anlauf at gcc dot gnu.org --- I agree that there is a strange bookkeeping issue. Swapping the order of the two functions in comment#0 makes the ICE go away. Printing forall_save, nvar, total_var in gfc_resolve_forall may give a clue what makes the difference.