From patchwork Wed Aug 28 09:50:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Pettersson X-Patchwork-Id: 270423 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id B80882C008C for ; Wed, 28 Aug 2013 19:51:15 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:content-type:content-transfer-encoding:message-id :date:from:to:subject; q=dns; s=default; b=nPKfhfSHdRMFbO5CUbJBB Zgo/JWuPtiKnE8GwjeiZYXz+HjgZr2CrGUxve4iXmRJzeweXbelcM1yvFV71V8IC FBI1O8cYty0mmxFUwIDKMhcDuvYc39XW/wZ2fyHdJrx22X8bQbxbi77Q9BrhTtjB liNIE9tnynlDiUCBWi7oaQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:content-type:content-transfer-encoding:message-id :date:from:to:subject; s=default; bh=UqrxPokw2CPh8DN3R7e3W+6aN6E =; b=PXT1xcInc/v4ZAegmz3FNCpPS8wqkT2qKt3IqlS9eVziRgd5eRCW4Q4sddJ O8akvYqvBORChVCB53cpWDwloTf43KskBvqxUDYXF6yy8eqV4Ab9ifmkbGPBm992 vg0ffONAtAyJYcSuJF869qFpo4ObYznNsqoqyNUD4wIwGaAY= Received: (qmail 3170 invoked by alias); 28 Aug 2013 09:51:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 3157 invoked by uid 89); 28 Aug 2013 09:51:08 -0000 Received: from smtp1.uu.se (HELO smtp1.uu.se) (130.238.7.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 28 Aug 2013 09:51:08 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp1.uu.se Received: from pilspetsen.it.uu.se (pilspetsen.it.uu.se [130.238.18.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by bornea.its.uu.se (Postfix) with ESMTPS id BD8D438018 for ; Wed, 28 Aug 2013 11:50:53 +0200 (CEST) Received: (from mikpe@localhost) by pilspetsen.it.uu.se (8.14.5+Sun/8.14.5) id r7S9onBj017830; Wed, 28 Aug 2013 11:50:49 +0200 (MEST) MIME-Version: 1.0 Message-ID: <21021.51193.481175.332729@pilspetsen.it.uu.se> Date: Wed, 28 Aug 2013 11:50:49 +0200 From: Mikael Pettersson To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/2] fix PR49847 ICE-on-HAVE_cc0 regression from PR50780 changes This patch fixes an ICE that occurs in #ifdef HAVE_cc0 code. The ICE breaks both Java and Ada bootstrap on m68k-linux. There is also a tiny C++ test case in the BZ entry. The ICE is triggered by the PR middle-end/50780 changes in r180192. As explained in , the effect of those changes is that an expression in EH context is broken up so that the cc0 setter and user are put in separate BBs, which normally isn't allowed. As fold_rtx sees the cc0 user, it calls equiv_constant on prev_insn_cc0, but that is NULL due to the BB boundary, resulting in the ICE. This patch checks if prev_insn_cc0 is NULL, and if so doesn't call equiv_constant but sets const_arg to zero, which avoids the ICE and makes fold_rtx leave the insn unchanged. Bootstrapped and regtested on m68k-linux, no regressions. This patch has been in 4.6-based production compilers on m68k-linux since early 2012, and in a 4.7-based compiler since early 2013. Ok for trunk and 4.8? [If approved I'll need help to commit it as I don't have commit rights.] gcc/ 2013-08-28 Mikael Pettersson PR rtl-optimization/49847 * cse.c (fold_rtx) : If prev_insn_cc0 is NULL don't call equiv_constant on it. --- gcc-4.9-20130818/gcc/cse.c.~1~ 2013-08-05 22:16:05.000000000 +0200 +++ gcc-4.9-20130818/gcc/cse.c 2013-08-24 16:38:40.912803915 +0200 @@ -3194,9 +3194,14 @@ fold_rtx (rtx x, rtx insn) #ifdef HAVE_cc0 case CC0: - folded_arg = prev_insn_cc0; - mode_arg = prev_insn_cc0_mode; - const_arg = equiv_constant (folded_arg); + if (!prev_insn_cc0) + const_arg = 0; + else + { + folded_arg = prev_insn_cc0; + mode_arg = prev_insn_cc0_mode; + const_arg = equiv_constant (folded_arg); + } break; #endif