From patchwork Fri Jun 7 22:07:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Iyer, Balaji V" X-Patchwork-Id: 249856 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 919F62C00AB for ; Sat, 8 Jun 2013 08:07:38 +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:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=gXo zaXc/9RXJF1RSJ/AWJWv/14VGzcW+7ls2N5T4r9devVv64rEpa1rUTKkFVzaZIZy n5lX5FpkzyFkvUdMdFjw1sq1GbkX4Bjc7T/ueAej/v4FY+pG70nyYw7a5o1GyXpe jCj7fnUFuI6Wy4Ct4oDuv+XyPp1y2hkun1wwEWa0= 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:content-type :content-transfer-encoding:mime-version; s=default; bh=mRhOZ44kL w/V0KCDVUQ8J6C5OT4=; b=BDk2hmKiuSbVQ7dvNtp3Xzhlumcb4KHKbR87/HADv T4vsi6L2YLU34U4Pd3zGz6/5YnUlLm7TZuG2qm1j46+qf9a4/TKjFRAuDOci/T9s 7hnTGwKI6erGOQupAL1dTklwOs4+3DIOSIwkkqYqinZ+XJQnlu9ly6aOHYUnQ5AU hY= Received: (qmail 4501 invoked by alias); 7 Jun 2013 22:07: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 4491 invoked by uid 89); 7 Jun 2013 22:07:32 -0000 X-Spam-SWARE-Status: No, score=-5.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_PASS, SUBJ_ALL_CAPS autolearn=no version=3.3.1 Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 07 Jun 2013 22:07:31 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 07 Jun 2013 15:07:22 -0700 X-ExtLoop1: 1 Received: from fmsmsx106.amr.corp.intel.com ([10.19.9.37]) by orsmga002.jf.intel.com with ESMTP; 07 Jun 2013 15:07:22 -0700 Received: from fmsmsx101.amr.corp.intel.com ([169.254.1.135]) by FMSMSX106.amr.corp.intel.com ([169.254.6.102]) with mapi id 14.03.0123.003; Fri, 7 Jun 2013 15:07:21 -0700 From: "Iyer, Balaji V" To: "gcc-patches@gcc.gnu.org" CC: "anna.m.tikhonova@gmail.com" Subject: [PATCH] PR 57541 Date: Fri, 7 Jun 2013 22:07:21 +0000 Message-ID: MIME-Version: 1.0 Hello Everyone, This patch below should fix the bug reported in PR 57541. The following statements were not caught by the array notation expander, and they should be caught and replaced with zero nodes: A[:]; A[x:y]; A[x:y:z]; Here are the Changelogs gcc/c/ChangeLog 2013-06-07 Balaji V. Iyer * c-array-notation.c (expand_array_notation_exprs): Added ARRAY_NOTATION_REF case. gcc/testsuite/ChangeLog 2013-06-07 Balaji V. Iyer PR middle-end/57541 * c-c++-common/cilk-plus/AN/pr57541.c: New test case. ... and the patch cut and pasted below: Since this is a trivial patch, I will commit this in. I am willing to revert it (and/or fix it) if anyone has objections. Thanks, Balaji V. Iyer. Index: gcc/c/c-array-notation.c =================================================================== --- gcc/c/c-array-notation.c (revision 199825) +++ gcc/c/c-array-notation.c (working copy) @@ -2317,6 +2317,14 @@ case RETURN_EXPR: if (contains_array_notation_expr (t)) t = fix_return_expr (t); + return t; + case ARRAY_NOTATION_REF: + /* IF we are here, then we are dealing with cases like this: + A[:]; + A[x:y:z]; + A[x:y]; + Replace those with just void zero node. */ + t = void_zero_node; default: return t; } Index: gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c =================================================================== --- gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c (revision 0) +++ gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c (revision 0) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-fcilkplus" } */ + +int A[10]; + +int main () { + char c = (char)N; /* { dg-error "undeclared" } */ + short s = (short)N; + long l = (long)N; + A[l:s:c]; +} + +/* { dg-message "note: each" "defined" { target *-*-* } 7 } */ +