From patchwork Thu Nov 28 16:05:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 294956 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 122952C0097 for ; Fri, 29 Nov 2013 03:06:04 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=QQLfKhlPz1pl2q+IXzFWaVupY5IKq 9zyZj++EHSlt4WyVBnSqIZsd65k75HDpk1qUo90CjDKhUekUIlWoXDjZSl0FDzOD 3e3sRsBGsKgBRQh9BEdkTWESR1flcRYqbtPvKZ4uhT/qYWkDKPxPIVc5HZAST5/T UGtQ7hq8TJ8CMk= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=ThLLsLLB5XlaSETiVvgO+odZITQ=; b=dZc Y8xQe2MZ7abYqqKvS2MFjRoJNANbwRoBBtiSt0HW2Z7TZ+SnsXesu+eCp/+jZogK HO6akeN2QoU0E9TcsGtkcHkPvTIDvAfNp7Auh7FQSbil4Jf+D3yOKvb/UNPWxoBE iGxROg5dLl+5K8/bOiz4tPrEd1+zUU7dX+b9psW0= Received: (qmail 9696 invoked by alias); 28 Nov 2013 16:05:53 -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 9684 invoked by uid 89); 28 Nov 2013 16:05:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_05, NO_DNS_FOR_FROM, RDNS_NONE, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mga11.intel.com Received: from Unknown (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 28 Nov 2013 16:05:51 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 28 Nov 2013 08:05:40 -0800 X-ExtLoop1: 1 Received: from gnu-mic-2.sc.intel.com ([172.25.70.58]) by fmsmga001.fm.intel.com with ESMTP; 28 Nov 2013 08:05:40 -0800 Received: by gnu-mic-2.sc.intel.com (Postfix, from userid 500) id E7D4211F8CE; Thu, 28 Nov 2013 08:05:39 -0800 (PST) Date: Thu, 28 Nov 2013 08:05:39 -0800 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: "Balaji V. Iyer" Subject: PATCH: PR c/59309: FAIL: c-c++-common/cilk-plus/CK/spawnee_inline.c -g -fcilkplus (test for excess errors) Message-ID: <20131128160539.GA21530@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi, For function without arguments, gimplify_cilk_spawn checks *arg_array == NULL_TREE But arg_array is a TREE vector of zero elements. This patch updates gimplify_cilk_spawn to properly handle function without arguments. Tested on Linux/x86-64 with GCC bootstraped using -fsanitize=address. OK to install? Thanks. H.J. ---- 2013-11-28 H.J. Lu PR c/59309 * cilk.c (gimplify_cilk_spawn): Properly handle function without arguments. diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c index c85b5f2..99d9c7e 100644 --- a/gcc/c-family/cilk.c +++ b/gcc/c-family/cilk.c @@ -757,7 +757,10 @@ gimplify_cilk_spawn (tree *spawn_p, gimple_seq *before ATTRIBUTE_UNUSED, /* This should give the number of parameters. */ total_args = list_length (new_args); - arg_array = XNEWVEC (tree, total_args); + if (total_args) + arg_array = XNEWVEC (tree, total_args); + else + arg_array = NULL; ii_args = new_args; for (ii = 0; ii < total_args; ii++) @@ -771,7 +774,7 @@ gimplify_cilk_spawn (tree *spawn_p, gimple_seq *before ATTRIBUTE_UNUSED, call1 = cilk_call_setjmp (cfun->cilk_frame_decl); - if (*arg_array == NULL_TREE) + if (arg_array == NULL || *arg_array == NULL_TREE) call2 = build_call_expr (function, 0); else call2 = build_call_expr_loc_array (EXPR_LOCATION (*spawn_p), function,