From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cc-smtpout3.netcologne.de (cc-smtpout3.netcologne.de [89.1.8.213]) by sourceware.org (Postfix) with ESMTPS id 9F2BF3850854; Sun, 26 Jun 2022 09:14:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9F2BF3850854 Received: from cc-smtpin1.netcologne.de (cc-smtpin1.netcologne.de [89.1.8.201]) by cc-smtpout3.netcologne.de (Postfix) with ESMTP id 55953123AB; Sun, 26 Jun 2022 11:14:21 +0200 (CEST) Received: from [IPV6:2001:4dd7:3fa9:0:7285:c2ff:fe6c:992d] (2001-4dd7-3fa9-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de [IPv6:2001:4dd7:3fa9:0:7285:c2ff:fe6c:992d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by cc-smtpin1.netcologne.de (Postfix) with ESMTPSA id 019D311D6D; Sun, 26 Jun 2022 11:14:18 +0200 (CEST) Message-ID: <901c2c54-57a9-92ac-59e1-535a1f4227c6@netcologne.de> Date: Sun, 26 Jun 2022 11:14:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] Fortran: fix simplification of INDEX(str1,str2) [PR105691] Content-Language: en-US To: Harald Anlauf , fortran , gcc-patches References: From: Thomas Koenig In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-NetCologne-Spam: L X-Rspamd-Queue-Id: 019D311D6D X-Spamd-Bar: - X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Sun, 26 Jun 2022 09:14:23 -0000 Hello Harald, > compile time simplification of INDEX(str1,str2,back=.true.) gave wrong > results. Looking at gfc_simplify_index, this appeared to be close to > a complete mess, while the runtime library code - which was developed > later - was a relief. > > The solution is to use the runtime library code as template to fix this. > I took the opportunity to change string index and length variables > in gfc_simplify_index to HOST_WIDE_INT. > > Regtested on x86_64-pc-linux-gnu. OK for mainline? > > As this is a wrong-code issue, would this qualify for backports to > open branches? OK for both. Thanks for the patch! Best regards Thomas