From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id 5BE843858C83; Sat, 26 Mar 2022 17:13:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5BE843858C83 Received: by mail-ej1-x631.google.com with SMTP id r13so20912751ejd.5; Sat, 26 Mar 2022 10:13:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=h5GMORbYpqkfDeVUwrlGTRFHhE4vqFv6Rse7ZaDWrFk=; b=i6eFaIeHlbs22bhdN4lQbMjwRHBcJL+JLq7QiuE6/0pyM0MlHJWlQBfNbv/uqFANYH 5Kb2lXby/bHvYRWnfaV1pD5anKDiXFUELIaw/HO9DYjYU59rrwh05yTnV5FBRgvI4TCC jLYz4VsRyMBiMKTa/zjifeEqaRe/NQ4jtJNf3Rekm9svjuJzUwL6PaoMrDxsCbV7fDBy TlG0bOJ1kZ+3EzxzSL+ThjOFrX5m8FsuA8Ak2BR24gUtURk3HGdTd/SYtAjDE1ywFqIr L1pRyHd97k24JnS6eG+wLn6p3qx3KuUrObPKAworauUuSU6kWfc2CPSTgL8VBnlRovw+ Pwjw== X-Gm-Message-State: AOAM533AS8uFB09r2jceTdmsH6CJ8YnyZ8hc655oXINjqgEvh/NGa4mw gQKuPQOkVzvhtqKs2fP6/CAFhKp45X4= X-Google-Smtp-Source: ABdhPJzQj8rTM5LRe0ZvSvAr+ZiIUUUrtZz9QzG5c3vUgMHhEk0xkSQWcGbOVQyHGwVJ/fw5PyfK2Q== X-Received: by 2002:a17:907:3d87:b0:6e0:bef:c3cb with SMTP id he7-20020a1709073d8700b006e00befc3cbmr18094054ejc.503.1648314788988; Sat, 26 Mar 2022 10:13:08 -0700 (PDT) Received: from smtpclient.apple (dynamic-077-007-043-248.77.7.pool.telefonica.de. [77.7.43.248]) by smtp.gmail.com with ESMTPSA id q16-20020a170906145000b006bdaf981589sm3707932ejc.81.2022.03.26.10.13.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Mar 2022 10:13:08 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691] Date: Sat, 26 Mar 2022 18:13:07 +0100 Message-Id: <28A2E8D9-E445-4C98-94A0-28382ED1AD30@gmail.com> References: Cc: Jakub Jelinek , Tobias Burnus , GCC Patches , fortran@gcc.gnu.org In-Reply-To: To: Thomas Koenig X-Mailer: iPhone Mail (19E241) X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Mar 2022 17:13:12 -0000 > Am 26.03.2022 um 12:28 schrieb Thomas Koenig : >=20 > =EF=BB=BFOn 25.03.22 12:34, Jakub Jelinek via Fortran wrote: >> What is the behavior with a RANGE_EXPR when one has { [0..10] =3D ++i; >> }, is that applying the side-effects 11 times or once ? >=20 > 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 >=20 > 10.1.7 Evaluation of operands >=20 > 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. >=20 > Also, the semantics of >=20 > a(a:b) =3D expr >=20 > say that the expression on the LHS is evaluated only once before > assignment. So, anything that looks like that should be translated > to >=20 > tmp =3D ++i; > [0..10] =3D tmp; Note I was not trying to question middle-end semantic here but gfortran se_e= xpr (?) one. Is there a Fortan input where Jakob=E2=80=99s patch would cause= a side-effect to be dropped and is that valid? Richard. >=20 >=20