Hi all,

attached patch is the last one the meta-bug 87477 ASSOCIATE depends on. The
resolution was already given in the PR, so I just beautified it and made patch
for it. I tried to come up with a testcase as well as Harald has, but had no
luck with it. I see less harm in reseting the flag in the error case than not
to do it.

Regtests ok on x86_64-pc-linux-gnu / Fedora 39. Ok for mainline?

Regards,
        Andre
--
Andre Vehreschild * Email: vehre ad gmx dot de
From 02e96672b2c9891ade40497298e2c69652e3d321 Mon Sep 17 00:00:00 2001
From: Andre Vehreschild <ve...@gcc.gnu.org>
Date: Tue, 13 Aug 2024 15:06:56 +0200
Subject: [PATCH] [Fortran] Prevent future proc_ptr parsing issues in associate
 [PR102973]

A global variable is set when proc_ptr parsing in an associate is
expected. In the case of an error, that flag was not reset, which is
fixed now.

gcc/fortran/ChangeLog:

	PR fortran/102973

	* match.cc (gfc_match_associate): Reset proc_ptr parsing flag on
	error.
---
 gcc/fortran/match.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc
index 4acdb146439..d30a98f48fa 100644
--- a/gcc/fortran/match.cc
+++ b/gcc/fortran/match.cc
@@ -1932,6 +1932,7 @@ gfc_match_associate (void)
 	  gfc_matching_procptr_assignment = 1;
 	  if (gfc_match (" %e", &newAssoc->target) != MATCH_YES)
 	    {
+	      gfc_matching_procptr_assignment = 0;
 	      gfc_error ("Invalid association target at %C");
 	      goto assocListError;
 	    }
--
2.46.0

Reply via email to