From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id EF184396D81A for ; Wed, 16 Nov 2022 20:25:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EF184396D81A Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=m.gmane-mx.org Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1ovOxx-0009nX-Gz for gcc-patches@gcc.gnu.org; Wed, 16 Nov 2022 21:25:01 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: gcc-patches@gcc.gnu.org From: Harald Anlauf Subject: Re: [PATCH] Fortran: ICE in simplification of array expression involving power [PR107680] Date: Wed, 16 Nov 2022 21:24:54 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Content-Language: en-US In-Reply-To: Cc: fortran@gcc.gnu.org X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_SHORT,NICE_REPLY_A,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: Message-ID: <20221116202454.il6O7A3Dva-XAbZfSaCmWOk8i22DLh436gBXYd_pJb8@z> Am 16.11.22 um 12:39 schrieb Mikael Morin: > Le 15/11/2022 à 21:45, Harald Anlauf via Fortran a écrit : >> Dear all, >> >> when constant expressions involve parentheses, array constructors, >> typespecs, and the power operator (**), we could fail with an ICE >> during simplification in arith_power. >> >> Debugging of the testcase showed we call the proper type conversions >> needed for the arithmetic operation, but under certain circumstances >> we seem to lose the typespec on the way to the invocation of the >> simplification.  We then run into unhandled combinations of operand >> types. >> >> The attached patch is likely a sort of a band-aid to the problem: >> we check the operand types in arith_power, and if we see that a >> conversion is (still) needed, we punt and defer the simplification. >> >> AFAICT this is safe.  It does not address a possibly deeply >> covered issue in gfortran, which was suspected when analyzing >> pr107000.  But as this is elusive, that may be hard to locate >> and fix. >> >> Regtested on x86_64-pc-linux-gnu.  OK for mainline? >> > Yes, let's go with this. > Thanks for investigating. > Thanks, pushed. I've opened a PR for the elusive loss of the typespec so that it won't be forgotten: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107721 Really a weird thing...