diff mbox series

[Fortran,PR102973,v1] Reset flag for parsing proc_ptrs in associate in error case

Message ID 20240813151522.482751b8@vepi2
State New
Headers show
Series [Fortran,PR102973,v1] Reset flag for parsing proc_ptrs in associate in error case | expand

Commit Message

Andre Vehreschild Aug. 13, 2024, 1:15 p.m. UTC
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

Comments

Harald Anlauf Aug. 13, 2024, 4:29 p.m. UTC | #1
Hi Andre,

Am 13.08.24 um 15:15 schrieb Andre Vehreschild:
> 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.

this is much simpler than Berhhard's patch while functionally equivalent
and good for mainline.

Thanks for taking care of the issue!

Harald

> Regtests ok on x86_64-pc-linux-gnu / Fedora 39. Ok for mainline?
>
> Regards,
> 	Andre
> --
> Andre Vehreschild * Email: vehre ad gmx dot de
Andre Vehreschild Aug. 14, 2024, 8:07 a.m. UTC | #2
Hi Harald,

thanks for the review. Comitted as gcc-15-2911-g54be14bfd6e.

Do you have time for reviewing the pr110033 fix? See
here: https://gcc.gnu.org/pipermail/fortran/2024-August/060814.html

Yes, it looks lengthy, but it is always the same propagation of the corank and
bit of meat in the second part of the patch. This would then allow to get the
dependencies of the  ASSOCIATE-PR to zero.

Thanks again and regards,
	Andre

On Tue, 13 Aug 2024 18:29:31 +0200
Harald Anlauf <anlauf@gmx.de> wrote:

> Hi Andre,
>
> Am 13.08.24 um 15:15 schrieb Andre Vehreschild:
> > 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.
>
> this is much simpler than Berhhard's patch while functionally equivalent
> and good for mainline.
>
> Thanks for taking care of the issue!
>
> Harald
>
> > Regtests ok on x86_64-pc-linux-gnu / Fedora 39. Ok for mainline?
> >
> > Regards,
> > 	Andre
> > --
> > Andre Vehreschild * Email: vehre ad gmx dot de
>


--
Andre Vehreschild * Email: vehre ad gmx dot de
diff mbox series

Patch

From 02e96672b2c9891ade40497298e2c69652e3d321 Mon Sep 17 00:00:00 2001
From: Andre Vehreschild <vehre@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