From patchwork Thu Oct 2 04:26:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 395793 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 7A69F1400B6 for ; Thu, 2 Oct 2014 14:28:45 +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:in-reply-to:references; q=dns; s= default; b=pQnj0rfAS/ZWJWOmJ0TePovFOdj4HlqYAf8nl8uxcgRq3bDseAHPa Oj0y/rjbc3tXDw9AaPwS+ap61vBYGIPD5DPTWnyAl9gO5XGSqB6QDPR/YtdSJwv3 cPn7SY7qhljKf7CL7m//Zg+U9P13SnwoBxLJvWMcsTGXdG2qlWAB5Y= 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:in-reply-to:references; s= default; bh=f6Of9Z0ruwnrMlrVRSkweuoeQJ8=; b=lekWknMIS0IF48T9EaxX XNhmW7OMi065AZLAlXtUJIzGcrcgF8nAukeamRUqzAFMFcph17CjzIbZRL0Fe21x zAXxK+VdPmTwHhYIuDAw+3zPFxFuXb/8cqIweK1VwPb4kmdVVUzXsKGXR97GamJ+ +e1RK3DQGx2fK1AoM10HkcI= Received: (qmail 24672 invoked by alias); 2 Oct 2014 04:28:13 -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 24560 invoked by uid 89); 2 Oct 2014 04:28:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: one.firstfloor.org Received: from one.firstfloor.org (HELO one.firstfloor.org) (193.170.194.197) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 02 Oct 2014 04:28:08 +0000 Received: from basil.firstfloor.org (184-100-254-193.ptld.qwest.net [184.100.254.193]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by one.firstfloor.org (Postfix) with ESMTPSA id C02CC869AD; Thu, 2 Oct 2014 06:28:01 +0200 (CEST) Received: by basil.firstfloor.org (Postfix, from userid 1000) id 01C3BA2002; Wed, 1 Oct 2014 21:26:59 -0700 (PDT) From: Andi Kleen To: gcc-patches@gcc.gnu.org Cc: Andi Kleen Subject: [PATCH 5/5] Add illegal cilk checks to C++ front. Date: Wed, 1 Oct 2014 21:26:58 -0700 Message-Id: <1412224018-25368-5-git-send-email-andi@firstfloor.org> In-Reply-To: <1412224018-25368-4-git-send-email-andi@firstfloor.org> References: <1412224018-25368-1-git-send-email-andi@firstfloor.org> <1412224018-25368-2-git-send-email-andi@firstfloor.org> <1412224018-25368-3-git-send-email-andi@firstfloor.org> <1412224018-25368-4-git-send-email-andi@firstfloor.org> From: Andi Kleen Add calls for several illegal Cilk cases to the C++ frontend. C++ usually doesn't ICE unlike C on illegal cilk, but it's better to match C in what is allowed and what is not. if (_Cilk_spawn ...) is still not errored, but at least it doesn't ICE. gcc/cp/: 2014-09-30 Andi Kleen * semantics.c (finish_goto_stmt): Call check_no_cilk. (finish_while_stmt_cond): Dito. (finish_do_stmt): Dito. (finish_for_cond): Dito. (finish_switch_cond): Dito. --- gcc/cp/semantics.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 7569826..9ca03be 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -621,6 +621,8 @@ finish_goto_stmt (tree destination) TREE_USED (destination) = 1; else { + if (check_no_cilk (destination, "as a computed goto expression")) + destination = error_mark_node; destination = mark_rvalue_use (destination); if (!processing_template_decl) { @@ -792,6 +794,8 @@ begin_while_stmt (void) void finish_while_stmt_cond (tree cond, tree while_stmt, bool ivdep) { + if (check_no_cilk (cond, "as a condition for while statement")) + cond = error_mark_node; cond = maybe_convert_cond (cond); finish_cond (&WHILE_COND (while_stmt), cond); begin_maybe_infinite_loop (cond); @@ -847,6 +851,8 @@ finish_do_body (tree do_stmt) void finish_do_stmt (tree cond, tree do_stmt, bool ivdep) { + if (check_no_cilk (cond, "as a condition for a do-while statement")) + cond = error_mark_node; cond = maybe_convert_cond (cond); end_maybe_infinite_loop (cond); if (ivdep && cond != error_mark_node) @@ -956,6 +962,8 @@ finish_for_init_stmt (tree for_stmt) void finish_for_cond (tree cond, tree for_stmt, bool ivdep) { + if (check_no_cilk (cond, "in a condition for a for-loop")) + cond = error_mark_node; cond = maybe_convert_cond (cond); finish_cond (&FOR_COND (for_stmt), cond); begin_maybe_infinite_loop (cond); @@ -1118,6 +1126,10 @@ void finish_switch_cond (tree cond, tree switch_stmt) { tree orig_type = NULL; + + if (check_no_cilk (cond, "as a condition for switch statement")) + cond = error_mark_node; + if (!processing_template_decl) { /* Convert the condition to an integer or enumeration type. */