From patchwork Thu Apr 10 19:55:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zamyatin, Igor" X-Patchwork-Id: 338269 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 3EF34140088 for ; Fri, 11 Apr 2014 05:55:39 +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:from :to:cc:subject:date:message-id:references:in-reply-to :content-type:content-transfer-encoding:mime-version; q=dns; s= default; b=rxU3nraBLP6xMDWpqJ+uQam+aOm3SbZ3Xdr8AgY5dlyEQ796Cg/Af kznkda1jyEZgvc0op9AyvgXu2qRqh1FvcDCyjTWkqVC2u8h2e0k8/9A+lztXt1If RBaXq8zFEbsceG7v+coFDH7l2GGU/gWnzxYpPUhGP12vq5IT7WOLmA= 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:from :to:cc:subject:date:message-id:references:in-reply-to :content-type:content-transfer-encoding:mime-version; s=default; bh=UFIeviAJD1dPitsrwrDSpAi0kjg=; b=GuxSFWYH62RsfZN3ivBK4KToP78L pTZLhf8jbKhlXrQLq39ZjEcDvQ+iNfOid3I7F29b13GEZa0Ng3BKsHcbFF3EBJuB zzXG/Vyr0sss+NfHHwW1QsSfwTewqYLffcept6EXfUSNFvzdWhMU+eg+U8uYMbIw UL1kcsMSEGdwA94= Received: (qmail 22193 invoked by alias); 10 Apr 2014 19:55:32 -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 22183 invoked by uid 89); 10 Apr 2014 19:55:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mga11.intel.com Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Apr 2014 19:55:30 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 10 Apr 2014 12:55:29 -0700 X-ExtLoop1: 1 Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by fmsmga002.fm.intel.com with ESMTP; 10 Apr 2014 12:55:27 -0700 Received: from irsmsx105.ger.corp.intel.com (163.33.3.28) by IRSMSX102.ger.corp.intel.com (163.33.3.155) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 10 Apr 2014 20:55:27 +0100 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.172]) by IRSMSX105.ger.corp.intel.com ([169.254.7.87]) with mapi id 14.03.0123.003; Thu, 10 Apr 2014 20:55:26 +0100 From: "Zamyatin, Igor" To: Jakub Jelinek CC: "GCC Patches (gcc-patches@gcc.gnu.org)" , "Iyer, Balaji V" Subject: RE: [PATCH, PR60469, Cilk+] Fix ICE of using Cilk_spawn and Array Notation together Date: Thu, 10 Apr 2014 19:55:26 +0000 Message-ID: <0EFAB2BDD0F67E4FB6CCC8B9F87D7569429DCFB3@IRSMSX103.ger.corp.intel.com> References: <0EFAB2BDD0F67E4FB6CCC8B9F87D7569429DCBE0@IRSMSX103.ger.corp.intel.com> <20140410172841.GH1817@tucnak.redhat.com> <0EFAB2BDD0F67E4FB6CCC8B9F87D7569429DCD89@IRSMSX103.ger.corp.intel.com> <20140410182048.GI1817@tucnak.redhat.com> In-Reply-To: <20140410182048.GI1817@tucnak.redhat.com> MIME-Version: 1.0 X-IsSubscribed: yes > -----Original Message----- > From: Jakub Jelinek [mailto:jakub@redhat.com] > Sent: Thursday, April 10, 2014 10:21 PM > To: Zamyatin, Igor > Cc: GCC Patches (gcc-patches@gcc.gnu.org); Iyer, Balaji V > Subject: Re: [PATCH, PR60469, Cilk+] Fix ICE of using Cilk_spawn and Array > Notation together > > On Thu, Apr 10, 2014 at 06:16:22PM +0000, Zamyatin, Igor wrote: > > Fixed patch is below. > > > > Just out of curiosity - why do you think this patch is not for 4.9? > > The one with just create_tmp_var (integer_type_node, NULL); is for 4.9. Got it, thanks. > For the iterator var changes, I guess one needs to analyze all the types used > for array annocations, and not just in C FE, but also C++ FE, plus really it > should be size_type_node or signed_size_type_node or ssizetype, not > long_type_node, that can differ, long could be still wider or narrower than > size_t/ssize_t. Agree, that will be a next step. So below is the patch for 4.9 trunk. Thanks, Igor gcc/c/Changelog: 2014-04-10 Igor Zamyatin PR middle-end/60469 * c-array-notation.c (fix_builtin_array_notation_fn): Use create_tmp_var instead build_decl for creating temps. (build_array_notation_expr): Likewise. (fix_conditional_array_notations_1): Likewise. (fix_array_notation_expr): Likewise. (fix_array_notation_call_expr): Likewise. gcc/testsuite/ChangeLog: 2014-04-10 Igor Zamyatin PR middle-end/60469 * c-c++-common/cilk-plus/CK/pr60469.c: New test. > > Jakub diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c index 6a5631c..0ac6ba8 100644 --- a/gcc/c/c-array-notation.c +++ b/gcc/c/c-array-notation.c @@ -70,6 +70,7 @@ #include "coretypes.h" #include "tree.h" #include "c-tree.h" +#include "gimple-expr.h" #include "tree-iterator.h" #include "opts.h" #include "c-family/c-common.h" @@ -282,8 +283,7 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree *new_var) for (ii = 0; ii < rank; ii++) { - an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE, - integer_type_node); + an_loop_info[ii].var = create_tmp_var (integer_type_node, NULL); an_loop_info[ii].ind_init = build_modify_expr (location, an_loop_info[ii].var, TREE_TYPE (an_loop_info[ii].var), NOP_EXPR, @@ -781,8 +781,8 @@ build_array_notation_expr (location_t location, tree lhs, tree lhs_origtype, for (ii = 0; ii < lhs_rank; ii++) if (lhs_an_info[0][ii].is_vector) { - lhs_an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE, - integer_type_node); + lhs_an_loop_info[ii].var = create_tmp_var (integer_type_node, + NULL); lhs_an_loop_info[ii].ind_init = build_modify_expr (location, lhs_an_loop_info[ii].var, TREE_TYPE (lhs_an_loop_info[ii].var), NOP_EXPR, @@ -793,8 +793,8 @@ build_array_notation_expr (location_t location, tree lhs, tree lhs_origtype, { /* When we have a polynomial, we assume that the indices are of type integer. */ - rhs_an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE, - integer_type_node); + rhs_an_loop_info[ii].var = create_tmp_var (integer_type_node, + NULL); rhs_an_loop_info[ii].ind_init = build_modify_expr (location, rhs_an_loop_info[ii].var, TREE_TYPE (rhs_an_loop_info[ii].var), NOP_EXPR, @@ -970,8 +970,7 @@ fix_conditional_array_notations_1 (tree stmt) cilkplus_extract_an_triplets (array_list, list_size, rank, &an_info); for (ii = 0; ii < rank; ii++) { - an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE, - integer_type_node); + an_loop_info[ii].var = create_tmp_var (integer_type_node, NULL); an_loop_info[ii].ind_init = build_modify_expr (location, an_loop_info[ii].var, TREE_TYPE (an_loop_info[ii].var), NOP_EXPR, @@ -1067,8 +1066,7 @@ fix_array_notation_expr (location_t location, enum tree_code code, loop_init = push_stmt_list (); for (ii = 0; ii < rank; ii++) { - an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE, - integer_type_node); + an_loop_info[ii].var = create_tmp_var (integer_type_node, NULL); an_loop_info[ii].ind_init = build_modify_expr (location, an_loop_info[ii].var, TREE_TYPE (an_loop_info[ii].var), NOP_EXPR, @@ -1163,8 +1161,7 @@ fix_array_notation_call_expr (tree arg) } for (ii = 0; ii < rank; ii++) { - an_loop_info[ii].var = build_decl (location, VAR_DECL, NULL_TREE, - integer_type_node); + an_loop_info[ii].var = create_tmp_var (integer_type_node, NULL); an_loop_info[ii].ind_init = build_modify_expr (location, an_loop_info[ii].var, TREE_TYPE (an_loop_info[ii].var), NOP_EXPR, location, diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c new file mode 100644 index 0000000..ca0cf7f --- /dev/null +++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60469.c @@ -0,0 +1,15 @@ +/* PR middle-end/60469 */ +/* { dg-do compile } */ +/* { dg-options "-fcilkplus" } */ + +void foo() {} + +#define ALEN 1024 + +int main(int argc, char* argv[]) +{ + int b[ALEN]; + b[:] = 100; + _Cilk_spawn foo(); + return 0; +}