]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use gfc_commit_symbol() to remove UNDO status instead of new function.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 9 Mar 2025 18:35:06 +0000 (19:35 +0100)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 9 Mar 2025 18:47:42 +0000 (19:47 +0100)
This is a cleaner version, removing an unneeded function and
making sure that no memory leaks can occur if callers change.

gcc/fortran/ChangeLog:

PR fortran/119157
* gfortran.h (gfc_pop_undo_symbol): Remove prototype.
* interface.cc (gfc_get_formal_from_actual_arglist): Use
gfc_commit_symbol() instead of gfc_pop_undo_symbol().
* symbol.cc (gfc_pop_undo_symbol): Remove.

gcc/fortran/gfortran.h
gcc/fortran/interface.cc
gcc/fortran/symbol.cc

index f81be1d984c5fb4e216468b1907f4bfbd6ccedff..cf48d025768a60c3e60c2b9c78f681ee82145f9c 100644 (file)
@@ -3736,7 +3736,6 @@ void gfc_traverse_user_op (gfc_namespace *, void (*)(gfc_user_op *));
 void gfc_save_all (gfc_namespace *);
 
 void gfc_enforce_clean_symbol_state (void);
-void gfc_pop_undo_symbol (void);
 
 gfc_gsymbol *gfc_get_gsymbol (const char *, bool bind_c);
 gfc_gsymbol *gfc_find_gsymbol (gfc_gsymbol *, const char *);
index e3bc22f25e580c9d3750a1186cb663ae1b6009da..c59ed1f5306c7a5dd745031b71d1cd3c71de9b4b 100644 (file)
@@ -5836,8 +5836,6 @@ gfc_get_formal_from_actual_arglist (gfc_symbol *sym,
        {
          snprintf (name, GFC_MAX_SYMBOL_LEN, "_formal_%d", var_num ++);
          gfc_get_symbol (name, gfc_current_ns, &s);
-         /* We do not need this in an undo table.  */
-         gfc_pop_undo_symbol();
          if (a->expr->ts.type == BT_PROCEDURE)
            {
              gfc_symbol *asym = a->expr->symtree->n.sym;
@@ -5878,12 +5876,14 @@ gfc_get_formal_from_actual_arglist (gfc_symbol *sym,
          s->declared_at = a->expr->where;
          s->attr.intent = INTENT_UNKNOWN;
          (*f)->sym = s;
+         gfc_commit_symbol (s);
        }
       else  /* If a->expr is NULL, this is an alternate rerturn.  */
        (*f)->sym = NULL;
 
       f = &((*f)->next);
     }
+
 }
 
 
index 92cba41878421f0bc7ca78d9b1e92c595ded8d7a..81aa81df2eecbae25439828ad392e57f7db65bd2 100644 (file)
@@ -3898,11 +3898,6 @@ enforce_single_undo_checkpoint (void)
   gcc_checking_assert (single_undo_checkpoint_p ());
 }
 
-void
-gfc_pop_undo_symbol ()
-{
-  latest_undo_chgset->syms.pop();
-}
 
 /* Undoes all the changes made to symbols in the current statement.  */