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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Mikael Morin <mik...@gcc.gnu.org>:

https://gcc.gnu.org/g:b9cbd1a2c2f50d4e305938d97916011bd5839ce0

commit r14-3864-gb9cbd1a2c2f50d4e305938d97916011bd5839ce0
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Tue Sep 12 10:24:20 2023 +0200

    fortran: Undo new symbols in all namespaces [PR110996]

    Remove new symbols from all namespaces they may have been added to in case
a
    statement mismatches in the end and all the symbols referenced in it have
to
    be reverted.

    This fixes memory errors and random internal compiler errors caused by
    a new symbol left with dangling pointers but not properly removed from the
    namespace at statement rejection.

    Before this change, new symbols were removed from their own namespace
    (their ns field) only.  This change additionally removes them from the
    namespaces pointed to by respectively the gfc_current_ns global variable,
    and the symbols' formal_ns field.

            PR fortran/110996

    gcc/fortran/ChangeLog:

            * gfortran.h (gfc_release_symbol): Set return type to bool.
            * symbol.cc (gfc_release_symbol): Ditto.  Return whether symbol was
            freed.
            (delete_symbol_from_ns): New, outline code from...
            (gfc_restore_last_undo_checkpoint): ... here.  Delete new symbols
            from two more namespaces.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/pr110996.f90: New test.

Reply via email to