https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82009
Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jvdelisle at gcc dot gnu.org --- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- This seems on the verge of silly. The ICE is at an assert: assert (saved_local_decls == NULL_TREE); When the function gfc_process_block_locals concludes it does saved_local_decls = NULL_TREE; So as I looked at this I thought it is expected to be already set at NULL_TREE and it leaves it that way. Why not just set it instead of doing the assert. So I did this: diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 254768c5828..08c1ebd2d4b 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -6751,7 +6751,7 @@ gfc_process_block_locals (gfc_namespace* ns) { tree decl; - gcc_assert (saved_local_decls == NULL_TREE); + saved_local_decls = NULL_TREE; has_coarray_vars = false; generate_local_vars (ns); The problem goes away and it regression tests fine. saved_local_decls is used only in one other place where it is set in add_decl_as_local(). It is not reset anywhere else. So I think the pacth above is likely correct.