public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Mikael Morin <morin-mikael@orange.fr>
Cc: Tobias Burnus <tobias@codesourcery.com>,
	gfortran <fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	Harald Anlauf <anlauf@gmx.de>
Subject: Re: [PATCH] fortran: Avoid infinite self-recursion [PR105381]
Date: Tue, 26 Apr 2022 19:28:55 +0200	[thread overview]
Message-ID: <Ymgr1ztlUXBNPWPq@tucnak> (raw)
In-Reply-To: <737d7a95-33f0-4264-4ba7-caed687c3092@orange.fr>

On Tue, Apr 26, 2022 at 07:12:13PM +0200, Mikael Morin wrote:
> > I think we can't in C++11/C++14.  The options can be if orig_decl would be declared
> > earlier, then it can be
> >      tree orig_decl;
> >      if (DECL_P (expr)
> > 	&& DECL_LANG_SPECIFIC (expr)
> > 	&& (orig_decl = GFC_DECL_SAVED_DESCRIPTOR (expr))
> > 	&& orig_decl != expr)
> >        return non_negative_strides_array_p (orig_decl);
> > but I think this is generally frowned upon,
> > or one can repeat it like:
> >      if (DECL_P (expr)
> > 	&& DECL_LANG_SPECIFIC (expr)
> > 	&& GFC_DECL_SAVED_DESCRIPTOR (expr)
> > 	&& GFC_DECL_SAVED_DESCRIPTOR (expr) != expr)
> >        return non_negative_strides_array_p (GFC_DECL_SAVED_DESCRIPTOR (expr));
> 
> I think I’ll use that.  There are numerous places where macros are repeated
> like this already and everybody seems to be pleased with it.
> Thanks for the feedback, and for the suggestions.

Agreed in this case, GFC_DECL_SAVED_DESCRIPTOR is really just a dereference
at least in release compiler.  Doing that when the macro actually calls some
functions is worse.

	Jakub


  reply	other threads:[~2022-04-26 17:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-26 12:38 Mikael Morin
2022-04-26 13:22 ` Tobias Burnus
2022-04-26 13:32   ` Jakub Jelinek
2022-04-26 17:12     ` Mikael Morin
2022-04-26 17:28       ` Jakub Jelinek [this message]
2022-04-26 19:10       ` [PATCH v2] " Mikael Morin
2022-04-26 20:04         ` Harald Anlauf
2022-04-26 20:04           ` Harald Anlauf

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=Ymgr1ztlUXBNPWPq@tucnak \
    --to=jakub@redhat.com \
    --cc=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=morin-mikael@orange.fr \
    --cc=tobias@codesourcery.com \
    /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).