diff options
author | Mikael Morin <mikael@gcc.gnu.org> | 2024-01-19 18:47:36 +0100 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2024-01-20 16:35:17 +0100 |
commit | 6930e1f1055c39bea170c25f694f7301989e5d1d (patch) | |
tree | 8f7a6c45168ad4ec1f30a09cf4ecb1d154ef817c /gcc/fortran/parse.cc | |
parent | 8fd992a3dfa8c3e00d4a41846de2061ff6c5652a (diff) | |
download | gcc-6930e1f1055c39bea170c25f694f7301989e5d1d.zip gcc-6930e1f1055c39bea170c25f694f7301989e5d1d.tar.gz gcc-6930e1f1055c39bea170c25f694f7301989e5d1d.tar.bz2 |
fortran: Restore current interface info on error [PR111291]
This change is a followup to the fix for PR48776 (namely
r14-3572-gd58150452976c4ca65ddc811fac78ef956fa96b0 AKA
fortran: Restore interface to its previous state on error [PR48776]),
which cleaned up new changes from interfaces upon error.
Unfortunately, there is one case in that fix that is mishandled, visible
on unexpected_interface.f90 with valgrind or an asan-instrumented gfortran.
when an interface statement is found while parsing an interface body (which
is invalid), the current interface is replaced by the one from the new
statement, and as parsing continues, new procedures are added
to the new interface, which has been rejected and freed, instead of the
original one.
This change restores the current interface pointer to its previous value
on each rejected statement.
PR fortran/48776
PR fortran/111291
gcc/fortran/ChangeLog:
* parse.cc: Restore current interface to its previous value on error.
Diffstat (limited to 'gcc/fortran/parse.cc')
-rw-r--r-- | gcc/fortran/parse.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/fortran/parse.cc b/gcc/fortran/parse.cc index 98a04e7..a4fda6e 100644 --- a/gcc/fortran/parse.cc +++ b/gcc/fortran/parse.cc @@ -4038,6 +4038,7 @@ loop: default: gfc_error ("Unexpected %s statement in INTERFACE block at %C", gfc_ascii_statement (st)); + current_interface = save; reject_statement (); gfc_free_namespace (gfc_current_ns); goto loop; |