public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Thomas Koenig <tkoenig@netcologne.de>
Cc: Jakub Jelinek <jakub@redhat.com>,
	Tobias Burnus <tobias@codesourcery.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	fortran@gcc.gnu.org
Subject: Re: [PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691]
Date: Sat, 26 Mar 2022 18:13:07 +0100	[thread overview]
Message-ID: <28A2E8D9-E445-4C98-94A0-28382ED1AD30@gmail.com> (raw)
In-Reply-To: <a574c183-3f86-c41e-8ab2-122c0c1baaf6@netcologne.de>



> Am 26.03.2022 um 12:28 schrieb Thomas Koenig <tkoenig@netcologne.de>:
> 
> On 25.03.22 12:34, Jakub Jelinek via Fortran wrote:
>> What is the behavior with a RANGE_EXPR when one has { [0..10] = ++i;
>> }, is that applying the side-effects 11 times or once ?
> 
> For side effects during the evaluation of expression, Fortran has a
> clear "if you depend on it, it's your fault" rule.  In F 2018, it says
> 
> 10.1.7  Evaluation of operands
> 
> 1 It is not necessary for a processor to evaluate all of the operands of
> an expression, or to evaluate entirely each operand, if the value of the
> expression can be determined otherwise.
> 
> Also, the semantics of
> 
> a(a:b) = expr
> 
> say that the expression on the LHS is evaluated only once before
> assignment.  So, anything that looks like that should be translated
> to
> 
> tmp = ++i;
> [0..10] = tmp;

Note I was not trying to question middle-end semantic here but gfortran se_expr (?) one. Is there a Fortan input where Jakob’s patch would cause a side-effect to be dropped and is that valid?

Richard.

> 
> 

      reply	other threads:[~2022-03-26 17:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25  8:57 Jakub Jelinek
2022-03-25 10:13 ` Tobias Burnus
2022-03-25 11:16   ` Richard Biener
2022-03-25 11:34     ` Jakub Jelinek
2022-03-25 12:13       ` Richard Biener
2022-03-25 12:15         ` Jakub Jelinek
2022-03-26 11:27       ` Thomas Koenig
2022-03-26 17:13         ` Richard Biener [this message]

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=28A2E8D9-E445-4C98-94A0-28382ED1AD30@gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=tkoenig@netcologne.de \
    --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).