From patchwork Mon Sep 26 02:39:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 76978 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp950679qgf; Sun, 25 Sep 2016 19:40:03 -0700 (PDT) X-Received: by 10.66.183.108 with SMTP id el12mr33982842pac.102.1474857603590; Sun, 25 Sep 2016 19:40:03 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id c132si22557422pfb.9.2016.09.25.19.40.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Sep 2016 19:40:03 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-436818-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-436818-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-436818-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=HDYn6EwnXB0tR1zYT sc2Wsf9zTMpQTg2MNTNEkkx0VzPYOH12EUxvhEhyPPqIROv2grZ8jVeFREEiv6Vg qaStYWgKD7ry2mJSA7il/XipxI+jy3yLZNLzvtEusivyV2W4dBDKnTt9YUSG8h1B 5glyffm/pjYYwwsBC5lFc9pdy0= 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 :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=J4qs7qYYunz1nTsrJXdgdBw WpP8=; b=iHyJH+UgsG/gZDlnHep8h35XxRkt7ATjOM2v0m3QpSEScX0wtph+oaH V3xSiJ4ON3J6oVAQDsFy29pxIXwijPDgC3EBTNzd/SE7tRq6s+qlz1lmLGmkshw7 qMARgiYGyX78z9kZxcEiwOLrTibUi1Ij12HFY0nRpJG2BAYxF0wM= Received: (qmail 31370 invoked by alias); 26 Sep 2016 02:39:42 -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 31344 invoked by uid 89); 26 Sep 2016 02:39:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Received:10.66.43.82, isp X-HELO: mail-pa0-f44.google.com Received: from mail-pa0-f44.google.com (HELO mail-pa0-f44.google.com) (209.85.220.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Sep 2016 02:39:31 +0000 Received: by mail-pa0-f44.google.com with SMTP id qn7so40154569pac.3 for ; Sun, 25 Sep 2016 19:39:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=COWzq3OMtp9QjtbU9cA4cLM1REvZJHFKkkNIsYn1nyM=; b=agzHTE9F6JvS6/YN/Ar3EcRtsybqSymdD1RFlgX/AHlVRbhtlEo6bYZb3WXcs54U+U H+/fP153mFLvOQD52vwRn1uf+46iQPwuBE+E9WtyIaKaJyqxwORst8YJ+hkyc5H1zWHG x5t5Wd/sc4zsB2EsNkrEVFUxGaj33aSFqqx5wnB2DhEPSiMqCOJkyrQ67jn7++ZyAFqe qULNmDXC66JMet7FHxLnIWLX4FdrX5rskv3dzzepbq9cpR02sGRdm9epM9mPGt7SmqrL 3ShK7PNervx69wEq1BrCvl4VbconccDC6h6jR1SuPPWBPZ91Qv7eXe8LbniX4y8J4m+e gCSw== X-Gm-Message-State: AE9vXwOUpmso8ofh4Dm3oB5ffTCeTZKXGon14rCCds5Pud62L+N68YhrCPLuXpLiwrI0ycV0 X-Received: by 10.66.43.82 with SMTP id u18mr34086866pal.28.1474857568619; Sun, 25 Sep 2016 19:39:28 -0700 (PDT) Received: from [172.20.0.62] ([67.238.99.186]) by smtp.gmail.com with ESMTPSA id s82sm21785964pfg.42.2016.09.25.19.39.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Sep 2016 19:39:27 -0700 (PDT) Subject: Re: [PR77719] Fix ICE in pp_string, at pretty-print.c:955 To: "gcc-patches@gcc.gnu.org" References: From: kugan Message-ID: <80a87b62-c193-2309-332d-22b1949d3e91@linaro.org> Date: Mon, 26 Sep 2016 12:39:25 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: X-IsSubscribed: yes On 25/09/16 04:50, kugan wrote: > Hi, > > In make_new_ssa_for_def (tree-reassoc.c) we should use gimple_get_lhs to > get lhs instead of gimple_assign_lhs as stmt can be builtins too. > Attached patch fixes this. > > Testcase from PR (attached) seems to fail. I dont any fortran so I didnt > try fixing it. Any help here is appreciate. The log is: Here is a patch with the testcase based on the feedback from Joost VandeVondele and Dominique d'Humieres. Bootstrapped and regression tested on x86_64-linux-gnu with no new regressions. Is this OK for trunk? Thanks, kugan gcc/testsuite/ChangeLog: 2016-09-25 Kugan Vivekanandarajah * gfortran.dg/pr77719.f90: New test. gcc/ChangeLog: 2016-09-25 Kugan Vivekanandarajah * tree-ssa-reassoc.c (make_new_ssa_for_def): Use gimple_get_lhs to get lhs instead of gimple_assign_lhs as stmt can be builtins too. diff --git a/gcc/testsuite/gfortran.dg/pr77719.f90 b/gcc/testsuite/gfortran.dg/pr77719.f90 index e69de29..974d70a 100644 --- a/gcc/testsuite/gfortran.dg/pr77719.f90 +++ b/gcc/testsuite/gfortran.dg/pr77719.f90 @@ -0,0 +1,26 @@ +! PR middle-end/77719 +! { dg-do compile } +! { dg-options "-O3 -ffast-math" } + +SUBROUTINE urep_egr(erep,derep,surr) + INTEGER, PARAMETER :: dp=8 + REAL(dp), INTENT(inout) :: erep, derep(3) + REAL(dp), INTENT(in) :: surr(2) + REAL(dp) :: de_z, rz + INTEGER :: isp,spdim,jsp,nsp + IF (n_urpoly > 0) THEN + IF (r < spxr(1,1)) THEN + ispg: DO isp = 1,spdim ! condition ca) + IF (isp /= spdim) THEN + nsp = 5 ! condition cb + DO jsp = 0,nsp + IF( jsp <= 3 ) THEN + ELSE + erep = erep + surr(jsp-3)*rz**(jsp) + ENDIF + END DO + END IF + END DO ispg + END IF + END IF +END SUBROUTINE urep_egr diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 8fc76e4..d94ff70 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1158,7 +1158,7 @@ make_new_ssa_for_def (gimple *stmt) use_operand_p use; imm_use_iterator iter; tree new_lhs; - tree lhs = gimple_assign_lhs (stmt); + tree lhs = gimple_get_lhs (stmt); new_lhs = make_ssa_name (TREE_TYPE (lhs)); gimple_set_lhs (stmt, new_lhs);