From patchwork Sun Dec 18 12:11:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 88376 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp691369qgi; Sun, 18 Dec 2016 04:11:55 -0800 (PST) X-Received: by 10.84.142.131 with SMTP id 3mr10810754plx.124.1482063115167; Sun, 18 Dec 2016 04:11:55 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id y2si3320892plh.311.2016.12.18.04.11.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Dec 2016 04:11:55 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-444695-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-444695-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-444695-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=cVqhDy/Z8EDvYu7j8pA7pAbZjQ2NgM5eMLdk7YLWIRmi20 Nd9V6c+ucQyLmo/AhYeozTquuAX+DBhoqclCplup5+ILCMQhWWPKmyWVTzr6txnC 3Ya3RtJ0XZbDU/YQBLIITojpXkLFv3acdgvMA8k1cOMAUugzcvfhi5RMNaq54= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=WNmbOODnmUv/jdxpS9lqCdNlrBE=; b=fkVtiyvBK+DQ5uTkeKm/ NljXfsQVRBi5qjRAb/+86FFf/8u3KFIJ8IQSWXvxb5X/vGEvxMFMRvxVzZV7fTNR lz8hqB1g3Hw0E5FcuWKDnwXAHItDh7SM2vpvcbEtaxV21Tw+TpgPY9R2/BytsvAX nTFKWrSm0qBnAdpM/3Uvp2I= Received: (qmail 85749 invoked by alias); 18 Dec 2016 12:11:40 -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 85697 invoked by uid 89); 18 Dec 2016 12:11:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=HX-HELO:sk:mail-it, Reject, 2016-12-18 X-HELO: mail-it0-f51.google.com Received: from mail-it0-f51.google.com (HELO mail-it0-f51.google.com) (209.85.214.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 18 Dec 2016 12:11:25 +0000 Received: by mail-it0-f51.google.com with SMTP id b132so30058883iti.1 for ; Sun, 18 Dec 2016 04:11:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=5RJTfJ8bAfVyxjHIVb3gbl5h4TBTzYE2TpsskbhFfbU=; b=XnX1ewFq9yO16NlT202gXdHxUytQHyU0NHmgaTNDgPFbICB7pFVVkbyYdOUgEAuM43 MLFXEhQzyWMnru60zDfgDVnadXY7KWSus/i8r45RxV57zOTLj6uohHVk3wBOBkroBIwd joCGKJ1hrchbEN0qhcRE6l2g5TPGAE+dVBmeEFn1HXoWk12TrJzg6milyK5BTHDpdBsU tKFFaDJIu14sY6ESh1vkS0y3DsWGm1PlaJ5sbq2LKm9SiC/Sr7JkihdYgFiCUCjUXImI vyheLxlF7XvimOoPad4eSj2r0JjLQHEBMUX1mgNX1m6ZToWTZoG5gj3nrBITUNVOj1mr w1zQ== X-Gm-Message-State: AKaTC02kevWIvdzhSi9cTMOzgJ9AqpTfiNladcGgXaJADoKVRhbHls5DGQX8SZboBKNPxmD0j0nzX9pK3AMdYH5+ X-Received: by 10.36.58.85 with SMTP id m82mr11850309itm.29.1482063084043; Sun, 18 Dec 2016 04:11:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.47.92 with HTTP; Sun, 18 Dec 2016 04:11:23 -0800 (PST) From: Prathamesh Kulkarni Date: Sun, 18 Dec 2016 17:41:23 +0530 Message-ID: Subject: [gimplefe] reject invalid pass name in startwith To: gcc Patches , Richard Biener X-IsSubscribed: yes Hi Richard, The attached patch attempts to reject invalid pass-name in startwith and verified gimplefe tests pass with the patch (not sure if bootstrap is required?) Does it look OK ? Thanks, Prathamesh 2016-12-18 Prathamesh Kulkarni c/ * gimple-parser.c (c_parser_gimple_pass_list): Reject invalid pass name. testsuite/ * gcc.dg/gimplefe-19.c: New test-case. diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c index ddecaec..ec1dbb3 100644 --- a/gcc/c/gimple-parser.c +++ b/gcc/c/gimple-parser.c @@ -1046,6 +1046,17 @@ c_parser_gimple_pass_list (c_parser *parser) if (! c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>")) return NULL; + if (pass) + { + char *full_passname = (char *) xmalloc (strlen ("tree-") + strlen (pass) + 1); + strcpy (full_passname, "tree-"); + strcat (full_passname, pass); + opt_pass *p = g->get_passes ()->get_pass_by_name (full_passname); + if (!p || p->type != GIMPLE_PASS) + error_at (c_parser_peek_token (parser)->location, + "%s is not a valid GIMPLE pass\n", pass); + free (full_passname); + } return pass; } diff --git a/gcc/testsuite/gcc.dg/gimplefe-19.c b/gcc/testsuite/gcc.dg/gimplefe-19.c new file mode 100644 index 0000000..bb5be33 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gimplefe-19.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fgimple" } */ + +void __GIMPLE (startwith ("combine")) foo () /* { dg-error "not a valid GIMPLE pass" } */ +{ + return; +}