From patchwork Sat Jun 4 02:25:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 69317 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp538600qgf; Fri, 3 Jun 2016 19:25:54 -0700 (PDT) X-Received: by 10.98.27.215 with SMTP id b206mr9734577pfb.61.1465007154799; Fri, 03 Jun 2016 19:25:54 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id f1si11229054pfb.251.2016.06.03.19.25.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jun 2016 19:25:54 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-429043-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-429043-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-429043-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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=rFMluNgeqEocRb4SCSNpSyfPdGVYOvBgwwGEYsAlqpZsZAO/x4 ncS5dnFv44socdZ6DoHviIDBID7zjQgd5gvY5g4fGtYC2Dn/lzE1G3ck+6CHVsXd 58cJuyRs5vI0f15M7oCBrA1f3rmYcwcX59lSLfgzrKhpxI7BC5k8vxZlU= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=yWq6LnCrRee8QEj1iPtAWRii08U=; b=yK3ZSy6qVpg4IsmRem1o bgKERkvrVVK/8WBeUKb/aHA4EfLfWw7vcVOOo/X1Vpg1ngFZL9aslUmdvCE+JdJ9 phhK13OoMIVk9oc5ZiSI8BE+kwRgaTzn1TAr94lreLu7A6QA30lEPoRYUmGOIcTL bT+niOA/DEEM2WfXcJSWQ1g= Received: (qmail 110681 invoked by alias); 4 Jun 2016 02:25: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 110591 invoked by uid 89); 4 Jun 2016 02:25:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=2016-06-04, fn2, H*r:10.1.1, Hx-languages-length:2991 X-HELO: mail-pf0-f181.google.com Received: from mail-pf0-f181.google.com (HELO mail-pf0-f181.google.com) (209.85.192.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 04 Jun 2016 02:25:17 +0000 Received: by mail-pf0-f181.google.com with SMTP id g64so49126972pfb.2 for ; Fri, 03 Jun 2016 19:25:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version; bh=AwYE+lTP+2Wy+E4K/muVPoOlNU8+I7iGp4fKuLtCOic=; b=AjtJnzLQqmFmNIFdFl4rxZh+MJcDnkCHV6vV5/ZAyGOreEJ3dIBdPW6MZkFfMSC/Ci BCoQBauNfngbEvIrF98lcABC8HkWCdqYCuNSz5fEvOrK7fVkZrwNla+FxqOGaNwpMA8J i3t+Iuslvc/PRope2C06DccmOG1AM2VsL4fTdBQrID7Ay6DDIRWC6nrnPKQPfJRnY1Vo Cdf2SV4eKRPXEK6tPAzbyZql6AutbZ958b7GBoMvbiODqJ0P8MRrA9Yjma1mHpf7l/+Q zE5o/BdH786Cv3vbyHvVZZZtFAtnFjZ9ZrrKwpJaEO0VTf8HelknpEhGJwJ6j/S+nNNZ znUg== X-Gm-Message-State: ALyK8tJK6/D9DRC/OoFrpHYngVTYtLm9UIePKOzaodfM83xj+c3uoTS/Wg8QAvaGIIDS0CmK X-Received: by 10.98.80.134 with SMTP id g6mr9716434pfj.87.1465007115210; Fri, 03 Jun 2016 19:25:15 -0700 (PDT) Received: from [10.1.1.13] (58-6-183-210.dyn.iinet.net.au. [58.6.183.210]) by smtp.gmail.com with ESMTPSA id p1sm11187788pfb.73.2016.06.03.19.25.12 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 03 Jun 2016 19:25:13 -0700 (PDT) To: "gcc-patches@gcc.gnu.org" , Richard Biener From: kugan Subject: [PR71281] ICE on gcc trunk on knl, wsm, ivb and bdw targets Message-ID: <57523C01.5020808@linaro.org> Date: Sat, 4 Jun 2016 12:25:05 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, PR71281 happens when we use factored out negate stmt in other reassociations. Since we don't set the uid for this stmt, we hit the gcc_assert (in reassoc_stmt_dominates_stmt_p) which checks for uid being set. Attached patch fixes this. Regression tested on x86-64-linux-gnu with no new regression. Is this OK for trunk? Thanks, Kugan gcc/ChangeLog: 2016-06-04 Kugan Vivekanandarajah PR middle-end/71281 * tree-ssa-reassoc.c (reassociate_bb): Set uid for negate stmt. gcc/testsuite/ChangeLog: 2016-06-04 Kugan Vivekanandarajah PR middle-end/71281 * g++.dg/torture/pr71281.C: New test. diff --git a/gcc/testsuite/g++.dg/torture/pr71281.C b/gcc/testsuite/g++.dg/torture/pr71281.C index e69de29..7d429a9 100644 --- a/gcc/testsuite/g++.dg/torture/pr71281.C +++ b/gcc/testsuite/g++.dg/torture/pr71281.C @@ -0,0 +1,63 @@ +// PR middle-end/71281 +// { dg-do compile } +// { dg-additional-options "-std=c++11 -Ofast" } + + +template struct A; +template struct A<_Tp *> { typedef _Tp reference; }; + +template class B { +public: + typename A<_Iterator>::reference operator*(); +}; + +template class C; +template struct D; + +template struct D> { + using value_type = _Tp; + using const_pointer = _Tp *; + template using rebind_alloc = C<_Up>; +}; + +template struct __alloc_traits : D<_Alloc> { + typedef D<_Alloc> _Base_type; + typedef typename _Base_type::value_type &reference; + template struct F { + typedef typename _Base_type::template rebind_alloc<_Tp> other; + }; +}; + +template struct G { + typedef typename __alloc_traits<_Alloc>::template F<_Tp>::other + _Tp_alloc_type; +}; + +int a, b; +long d[1][1][1]; +void fn1() __attribute__((__noreturn__)); +template > class H { + typedef __alloc_traits::_Tp_alloc_type> _Alloc_traits; + typedef typename _Alloc_traits::reference reference; + +public: + B m_fn1(); + long m_fn2(); + reference operator[](unsigned); + reference m_fn3(unsigned){ + if (m_fn2()) + fn1(); + } +}; + +H>> c; +void fn2() { + H> e; + for (int f = 1;;) + for (int g = 0;;) + for (int h = 0;;) + { + *d[0][h] = + c.m_fn3(f)[0][g] * a + -*(e).m_fn1() * b + (*c[f].m_fn1()).m_fn3(g); + } +} diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 1973077..096b24d 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -5387,6 +5387,7 @@ reassociate_bb (basic_block bb) gimple_set_lhs (stmt, tmp); gassign *neg_stmt = gimple_build_assign (lhs, NEGATE_EXPR, tmp); + gimple_set_uid (neg_stmt, gimple_uid (stmt)); gimple_stmt_iterator gsi = gsi_for_stmt (stmt); gsi_insert_after (&gsi, neg_stmt, GSI_NEW_STMT); update_stmt (stmt);