https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78392

--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to janus from comment #2)
> As an alternative to removing the assert, one could possibly prevent SAVEd
> variables in the main PROGRAM from being declared as "static" (which might
> also cure the performance regressions that Dominique reported for my patch
> for PR 55207)?

This could possibly be accomplished like this:

Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c    (Revision 242584)
+++ gcc/fortran/trans-decl.c    (Arbeitskopie)
@@ -635,7 +635,8 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
      initialized variables are SAVE_IMPLICIT and explicitly saved are
      SAVE_EXPLICIT.  */
   if (!sym->attr.use_assoc
-       && (sym->attr.save != SAVE_NONE || sym->attr.data
+       && ((sym->attr.save != SAVE_NONE &&
!sym->ns->proc_name->attr.is_main_program)
+           || sym->attr.data
            || (sym->value && sym->ns->proc_name->attr.is_main_program)
            || (flag_coarray == GFC_FCOARRAY_LIB
                && sym->attr.codimension && !sym->attr.allocatable)))

That indeed removes the ICE on comment 0, however it causes loads of testsuite
regressions, so it's certainly not a very good idea.

Reply via email to