From patchwork Thu Apr 10 14:23:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Zamyatin, Igor" X-Patchwork-Id: 338137 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 9945B140086 for ; Fri, 11 Apr 2014 00:24:36 +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=Y2KYgtO/cW5QQ9V7ysiy4PoBzrv5t1GJbtXBHq0zoSEbVdpl5ie8P QUnGcFVTO9um/pRm8MFVFXPt6AFKhUOfysa4z8xYL3lnvdhiGAE1niyWGV0AvFbL JJj5s9KTaBhpw4tx3qYDkWjdLjim8Wwh7iiE4dL2J+ves2KDEwblGA= 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=DGtIvYGcXjvSg+8Yh2aEhElZn2U=; b=cusAqEc6S3XzX1jEI3dv6OjGLA2r 5dOPspIUGGFNiBlK5gaa6XODjqMWVWYb3OuA1cR7G80A6J6bII4C+Z+Shk2P5ENr 5SJlvc2ydNsMGqYNEGGAMPSVnrZT9sNPCz0GyKjJ4u4fQx9qhC9m21GdpbAHtcYv yUFp/70DB+aQfNQ= Received: (qmail 11910 invoked by alias); 10 Apr 2014 14:24:29 -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 11899 invoked by uid 89); 10 Apr 2014 14:24:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_50, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mga09.intel.com Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Apr 2014 14:24:28 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 10 Apr 2014 07:19:05 -0700 X-ExtLoop1: 1 Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by orsmga002.jf.intel.com with ESMTP; 10 Apr 2014 07:23:39 -0700 Received: from irsmsx152.ger.corp.intel.com (163.33.192.66) by IRSMSX104.ger.corp.intel.com (163.33.3.159) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 10 Apr 2014 15:23:17 +0100 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.172]) by IRSMSX152.ger.corp.intel.com ([169.254.6.180]) with mapi id 14.03.0123.003; Thu, 10 Apr 2014 15:23:17 +0100 From: "Zamyatin, Igor" To: "GCC Patches (gcc-patches@gcc.gnu.org)" CC: "Iyer, Balaji V" , "Jakub Jelinek (jakub@redhat.com)" Subject: RE: [PATCH, PR60189, Cilk+] Fix for ICE with incorrect Cilk_sync usage Date: Thu, 10 Apr 2014 14:23:16 +0000 Message-ID: <0EFAB2BDD0F67E4FB6CCC8B9F87D7569429DC138@IRSMSX103.ger.corp.intel.com> References: <0EFAB2BDD0F67E4FB6CCC8B9F87D7569429DBFEF@IRSMSX103.ger.corp.intel.com> In-Reply-To: <0EFAB2BDD0F67E4FB6CCC8B9F87D7569429DBFEF@IRSMSX103.ger.corp.intel.com> MIME-Version: 1.0 X-IsSubscribed: yes Resending with correct Changelog Is it OK? Thanks, Igor gcc/cp/ChangeLog: 2014-04-10 Igor Zamyatin PR c++/60189 * parser.c (cp_parser_postfix_expression): Make sure only semicolon can go after Cilk_sync. gcc/testsuite/ChangeLog: 2014-04-10 Igor Zamyatin PR c++/60189 * c-c++-common/cilk-plus/CK/invalid_sync.cс: New test. > -----Original Message----- > From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches- > owner@gcc.gnu.org] On Behalf Of Zamyatin, Igor > Sent: Thursday, April 10, 2014 5:56 PM > To: GCC Patches (gcc-patches@gcc.gnu.org) > Cc: Iyer, Balaji V; Jakub Jelinek (jakub@redhat.com) > Subject: [PATCH, PR60189, Cilk+] Fix for ICE with incorrect Cilk_sync usage > > Hi! > > This fixes ICE on inappropriate usage of Cilk_sync keyword. > > Bootstrapped/regtested on x86_64. Ok for trunk? > > > Thanks, > Igor > > diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 7bea3d2..95f9c93 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -5835,20 +5835,33 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p, } break; } - + case RID_CILK_SYNC: - if (flag_cilkplus) - { - tree sync_expr = build_cilk_sync (); - SET_EXPR_LOCATION (sync_expr, - cp_lexer_peek_token (parser->lexer)->location); - finish_expr_stmt (sync_expr); - } - else - error_at (token->location, "-fcilkplus must be enabled to use" - " %<_Cilk_sync%>"); - cp_lexer_consume_token (parser->lexer); - break; + { + cp_lexer_consume_token (parser->lexer); + if (flag_cilkplus) + { + token = cp_lexer_peek_token (parser->lexer); + if (token->type != CPP_SEMICOLON) + { + error_at (token->location, "%<_Cilk_sync%> must be followed" + " by semicolon"); + postfix_expression = error_mark_node; + break; + } + tree sync_expr = build_cilk_sync (); + SET_EXPR_LOCATION (sync_expr, + cp_lexer_peek_token (parser->lexer)->location); + finish_expr_stmt (sync_expr); + } + else + { + error_at (token->location, "-fcilkplus must be enabled to use" + " %<_Cilk_sync%>"); + postfix_expression = error_mark_node; + } + break; + } case RID_BUILTIN_SHUFFLE: { diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.сc b/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cс new file mode 100644 index 0000000..e7bec68 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/invalid_sync.cс @@ -0,0 +1,9 @@ +/* PR c/60189 */ +/* { dg-do compile } */ +/* { dg-options "-fcilkplus" } */ + +int main (void) +{ + _Cilk_sync return; /* { dg-error " '_Cilk_sync' must be followed by semicolon" } */ + return 0; +}