public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: Janus Weil <janus@gcc.gnu.org>
Cc: rep.dot.nop@gmail.com, Thomas Koenig <tkoenig@netcologne.de>,
	gfortran <fortran@gcc.gnu.org>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch, Fortran] PR 86935: Bad locus in ASSOCIATE statement
Date: Wed, 27 Oct 2021 19:40:58 +0200	[thread overview]
Message-ID: <20211027194058.2764dfdb@nbbrfq> (raw)
In-Reply-To: <CAC1BbcRS2E2-6pvrjmB7or9V1CyhqUh6WB3QCcc0xM8jB4ODnQ@mail.gmail.com>

AFAICS current trunk still has this issue.
Any takers?
thanks,

On Sun, 2 Sep 2018 17:16:07 +0200
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote:

>                                                i spotted one
> (pre-existing) possible inconsistency that i did overlook back then:
> 
> gfc_match_associate () reads
> ...
>       if (gfc_match (" %e", &newAssoc->target) != MATCH_YES)
>         {
>           /* Have another go, allowing for procedure pointer selectors.  */
>           gfc_matching_procptr_assignment = 1;
>           if (gfc_match (" %e", &newAssoc->target) != MATCH_YES)
>             {
>               gfc_error ("Invalid association target at %C");
>               goto assocListError;
>             }
>           gfc_matching_procptr_assignment = 0;
>         }
> 
> i.e. we retry a match, but in the second attempt we turn on procptr
> assignment matching and if that works, we turn procptr assignment
> matching off again.
> But if we fail that retry, we forget to turn it off again.
> I suppose we should:
> 
> $ svn diff -x -p gcc/fortran/match.c
> Index: gcc/fortran/match.c
> ===================================================================
> --- gcc/fortran/match.c (revision 264040)
> +++ gcc/fortran/match.c (working copy)
> @@ -1898,13 +1898,16 @@ gfc_match_associate (void)
>        if (gfc_match (" %e", &newAssoc->target) != MATCH_YES)
>   {
>     /* Have another go, allowing for procedure pointer selectors.  */
> +   match m;
> +
>     gfc_matching_procptr_assignment = 1;
> -   if (gfc_match (" %e", &newAssoc->target) != MATCH_YES)
> +   m = gfc_match (" %e", &newAssoc->target);
> +   gfc_matching_procptr_assignment = 0;
> +   if (m != MATCH_YES)
>       {
>         gfc_error ("Invalid association target at %C");
>         goto assocListError;
>       }
> -   gfc_matching_procptr_assignment = 0;
>   }
>        newAssoc->where = gfc_current_locus;
> 
> 
> Untested. Maybe someone wants to give it a whirl...
> If it wrecks havoc then leaving it set deliberately deserves at least a comment.
> 
> PS: It would be nice to get rid of gfc_matching_procptr_assignment,
> gfc_matching_ptr_assignment, gfc_matching_prefix, FWIW.
> cheers,
> >
> > Thanks everyone!
> >
> > Cheers,
> > Janus  


  reply	other threads:[~2021-10-27 17:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-13 19:45 Janus Weil
     [not found] ` <9F1BA124-0E74-496E-9AAC-53C86052CF5F@gmail.com>
     [not found]   ` <CAKwh3qg+r2i_o_wQzM5PVTjDjPetPDieUwE1qJ35OHTy0J288w@mail.gmail.com>
     [not found]     ` <fc7f64e4-7a1f-837e-b334-6d33aa81c8fa@netcologne.de>
     [not found]       ` <CAKwh3qhp33vCBTRYu=zpn1w_egt38woYr7O6hJ26G1FCtp9=CQ@mail.gmail.com>
2018-09-02 15:16         ` Bernhard Reutner-Fischer
2021-10-27 17:40           ` Bernhard Reutner-Fischer [this message]
     [not found]             ` <slca7k$11i7$1@ciao.gmane.io>
2021-10-27 20:46               ` Bernhard Reutner-Fischer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211027194058.2764dfdb@nbbrfq \
    --to=rep.dot.nop@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=janus@gcc.gnu.org \
    --cc=tkoenig@netcologne.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).