From patchwork Sat Mar 5 20:02:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 592451 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E25911402A8 for ; Sun, 6 Mar 2016 07:02:15 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=iCY7FIJb; dkim-atps=neutral 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=mCuIrvsIivk6lXfEUEcDs1Oa6HR9A9axjz38V1Y7XzqMhIUdjc cAwvPA66Avm+uOo9Et/G4B+4q6J+3OrYW1wshqMx88IVUchUm09QCKQPR53ihdOx RTvqPp6t7M7fApFw3bZzrqkBRM48mfDIVxIE5RNCaMOl6nqglpWO+SR9g= 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=h1CLSLEcerYCkMAQbOLgOxwy8nc=; b=iCY7FIJbsm8iAihB/u7p xZ7D3V6Mn9ExaIg7b1PahCWUvhoCoik19UgC9cytgeUhfLUPv4sw76BoVOv3iLGS C2XlsDgoZnJCIR1Pqu6IB0IbQFnfTn8QPTKkRZ1+4NJKiz7kuYbxlV+vmezCoavA TAzuehQoGauQWJowfiU22EQ= Received: (qmail 121390 invoked by alias); 5 Mar 2016 20:02:08 -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 121355 invoked by uid 89); 5 Mar 2016 20:02:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=locus, 3148 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 05 Mar 2016 20:02:05 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 5C46F70A9B for ; Sat, 5 Mar 2016 20:02:04 +0000 (UTC) Received: from bigtime.twiddle.net (ovpn-113-43.phx2.redhat.com [10.3.113.43]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u25K23Gd002848 for ; Sat, 5 Mar 2016 15:02:04 -0500 To: GCC Patches From: Richard Henderson Subject: [PATCH] Fix pr70061 Message-ID: <56DB3B3A.2050902@redhat.com> Date: Sat, 5 Mar 2016 15:02:02 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 X-IsSubscribed: yes The problem is that we are emitting copy sequences to edges without caring for deferred popping of arguments. Thus when we began emitting code for the first block, which in this case starts with a label, we had 32 bytes of pending stack adjustment, which emit_label flushed. The ICE is due to the label not being the first insn in the BB. There are two equivalent ways to fix this: we can either save/restore inhibit_defer_pop around these sequences, or we can manually flush any pending stack adjustment. This does the latter. Ok? r~ * tree-outofssa.c (emit_partition_copy): Flush pending stack adjust. (insert_value_copy_on_edge): Likewise. * gcc.c-torture/compile/pr70061.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr70061.c b/gcc/testsuite/gcc.c-torture/compile/pr70061.c new file mode 100644 index 0000000..a7ebcfc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr70061.c @@ -0,0 +1,10 @@ +typedef int v8si __attribute__ ((vector_size (32))); + +int +foo(v8si c, v8si d) +{ +l0: + if (c[2]) + d ^= c; + return d[3]; +} diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index 25286a2..4125529 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-ter.h" #include "tree-ssa-coalesce.h" #include "tree-outof-ssa.h" +#include "dojump.h" /* FIXME: A lot of code here deals with expanding to RTL. All that code should be in cfgexpand.c. */ @@ -220,6 +221,7 @@ emit_partition_copy (rtx dest, rtx src, int unsignedsrcp, tree sizeexp) } else emit_move_insn (dest, src); + do_pending_stack_adjust (); rtx_insn *seq = get_insns (); end_sequence (); @@ -312,6 +314,8 @@ insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus) if (x != dest_rtx) emit_move_insn (dest_rtx, x); + do_pending_stack_adjust (); + seq = get_insns (); end_sequence ();