From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 7D771385BF83 for ; Mon, 6 Apr 2020 22:57:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7D771385BF83 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-422-wNLxgh3IPMqPMST7bQ2M6g-1; Mon, 06 Apr 2020 18:57:48 -0400 X-MC-Unique: wNLxgh3IPMqPMST7bQ2M6g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 95B2618AB2C2 for ; Mon, 6 Apr 2020 22:57:47 +0000 (UTC) Received: from ovpn-114-204.phx2.redhat.com (ovpn-114-204.phx2.redhat.com [10.3.114.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id 460E6B19D7; Mon, 6 Apr 2020 22:57:47 +0000 (UTC) Message-ID: Subject: Re: [committed] cselib: Fix endless cselib loop on (plus:P (reg) (const_int 0)) From: Jeff Law Reply-To: law@redhat.com To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Date: Mon, 06 Apr 2020 16:57:46 -0600 In-Reply-To: <20200406223313.GV2212@tucnak> References: <20200406223313.GV2212@tucnak> Organization: Red Hat User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 22:57:51 -0000 On Tue, 2020-04-07 at 00:33 +0200, Jakub Jelinek wrote: > Hi! > > getopt.c hangs the compiler on h8300-elf with -O2 -g, because the > IL contains addition of constant 0, the first PLUS operand is determined > to have the SP_DERIVED_VALUE_P and the new code in cselib recurses > indefinitely on seeing SP_DERIVED_VALUE_P with locs of > (plus:P SP_DERIVED_VALUE_P (const_int 0)). > > Fixed by making sure cselib_subst_to_values canonicalizes it, hashing > already hashes it the same too. > > Bootstrapped/regtested on x86_64-linux and i686-linux, tested on the > getopt.i testcase using cross to h8300-elf, approved off-list by Jeff, > committed to trunk. > > 2020-04-06 Jakub Jelinek > > * cselib.c (cselib_subst_to_values): For SP_DERIVED_VALUE_P > + const0_rtx return the SP_DERIVED_VALUE_P. Thanks. And just FTR, the scenario where this happens could (in theory) happen on other ports, particularly those still using reload. jeff >