From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by sourceware.org (Postfix) with ESMTPS id 61E4A3858404; Thu, 6 Oct 2022 21:36:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 61E4A3858404 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1665092184; bh=J9DKW2Jz+ZLMAUCm1vsAxGrXIVNwLzIj4JOrXQHAkMc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=BjtgmqOGh4LLu+MjtCb6Dv1aKMUk4EyrMldBniWbu2tTLqknnBQ4YNmnWsVtP6qji uh7SnML70gZ8YwdOajlZ0VAwpL9URhZiGS8+lbJmvAD3QmRVgPr9uhfQXP3vToq3MV kiR6ctYo8xp85GaY+GygekOBspDicMuuWBkOxxHA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [79.251.13.86] ([79.251.13.86]) by web-mail.gmx.net (3c-app-gmx-bs37.server.lan [172.19.170.89]) (via HTTP); Thu, 6 Oct 2022 23:36:24 +0200 MIME-Version: 1.0 Message-ID: From: Harald Anlauf To: Mikael Morin Cc: fortran , gcc-patches Subject: Re: [PATCH, v2] Fortran: error recovery for invalid types in array constructors [PR107000] Content-Type: text/plain; charset=UTF-8 Date: Thu, 6 Oct 2022 23:36:24 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <97dd508f-83b0-5ed0-8cb5-f4f7c8fe08e6@orange.fr> References: <1bf3b7b5-39ac-0c94-256c-f739a4746a7b@orange.fr> <97dd508f-83b0-5ed0-8cb5-f4f7c8fe08e6@orange.fr> Content-Transfer-Encoding: quoted-printable X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:Mfsvu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1TrBMwLqWE1mV5k2PUzrB qaAJLxos1Z3rYygiZ3RNWBFtQtfEoF3PYoEvRF0wOra4hXhPYmFcsle+Ygp7DW/LlvCqd/HhP JFeP3qLMT3Q0cc3nrywOfUoodC6idCQNPl9zK0GOM9tm5NT8Rw1rhMTINf7PAh+LbfRmk2NjX d24L/4XkjLHV+r+twvF1nDXeLO+VjASDxvJ+eujlRhy2eNRC8TeIdplM1fs0kdummWi+y2qkL 3CjxwIslWRGmtOEzyE93MvPAj+QH8JcujJlP8bFRZEo6pifHSUZyWXqIxXzs6FfrWtlORYyjm 5fQpg9koJl6tKQDCjc4fAGyFOJM+SM1xCHtJprRSUuKI5jEVPJJWy/ZPYv4hv1IhCE+XRQ09t lsPgSUkPFhL9Md1Uji5wCM2HVPQwXpMXjvJRuNxEGIXnLLDdSIjsejxKHwqyyNABHWv0O490c o16FlF4IrG1GiuvqJyDA3NdmiXUTt6CuB61fRSvFCgGQ92jdkS5+4DRQDsZK//fgnZ2G1g0AL f4dO0nUavhX6gEMldqT/xEbALczXkI+du8dArLsZIZph/xqhGIP6K0eM3gL34uTIjcZF7mNfB OdJ2j1bu X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Mikael, > Gesendet: Donnerstag, 06=2E Oktober 2022 um 22:14 Uhr > Von: "Mikael Morin" > An: "Harald Anlauf" > Cc: "fortran" , "gcc-patches" > Betreff: Re: [PATCH, v2] Fortran: error recovery for invalid types in ar= ray constructors [PR107000] > > Le 05/10/2022 =C3=A0 23:40, Harald Anlauf a =C3=A9crit=C2=A0: > >=20 > >> There is one last thing that I'm dissatisfied with=2E > >> The handling of unknown types should be moved to reduce_binary, becau= se > >> the dispatching in reduce_binary doesn't handle EXPR_OP, so even if > >> either or both operands are scalar, they are handled by the (array vs > >> array) reduce_binary_aa function=2E That's confusing=2E >=20 > Thinking about it again, I'm not sure my suggestion is right here=2E > >=20 > > Do you have an example? > >=20 > No=2E Actually, I think it works, but a weird way=2E >=20 >=20 > For example, for this case: >=20 > [real :: 2] * [real :: +(=2Etrue=2E)] >=20 > First there is a "root" invocation of reduce binary with arguments [real= =20 > :: 2] and [real :: +(=2Etrue=2E)] > The root invocation of reduce_binary will call reduce_binary_aa=2E This = is=20 > normal=2E >=20 > Then reduce_binary_aa calls reduce_binary again with arguments 2 and=20 > +(=2Etrue=2E)=2E And reduce_binary calls again reduce_binary_aa with th= ose=20 > arguments=2E This is weird, reduce_binary_aa is supposed to have arrays= =20 > for both arguments=2E Am I seeing something different from you? My gdb says that one argument of reduce_binary is EXPR_CONSTANT, the other EXPR_OP and BT_UNKNOWN=2E Both rank 0=2E > The same goes for the array vs constant case, reduce_binary_ca (or=20 > reduce_binary_ac) is invoked with two scalars, while if you look at=20 > reduce_binary, you would expect that we only get to reduce_binary_ca=20 > with a scalar constant and an array as arguments=2E >=20 >=20 > I think the checks in the three reduce_binary_* functions should be=20 > moved into their respective loops, so that we detect the invalid type=20 > just before these weird recursive calls instead of just after entering= =20 > into them=2E I think I tried that before, and it didn't work=2E There was always one weird case that lead to a bad or invalid constructor for one of the arrays you want to look at in the respective loop, and this is why the testcase tries to cover everything that I hit then and there=2E=2E=2E (hopefully)=2E So I ended up with the check before the loop=2E What do we actually gain with your suggested change? Moving the check into the loop does not really make the code more readable to me=2E And the recursion is needed anyway=2E Cheers, Harald > OK with that change=2E >