From patchwork Wed Jul 15 16:00:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 51127 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 85AD922A24 for ; Wed, 15 Jul 2015 16:00:34 +0000 (UTC) Received: by wizo10 with SMTP id o10sf540954wiz.0 for ; Wed, 15 Jul 2015 09:00:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:mime-version:date:message-id:subject:from:to :content-type:x-original-sender:x-original-authentication-results; bh=QJdaNHnkIWWKJbM2vtOhHiaw1MzRGrxhF4JhqA396uU=; b=kBoLakcvojbQCZghBJ0yap4fyVXafOGNfSiJKU0Ap9tJh4K0Tmr6P/OjlP+qph2Y/8 ZDPhl37uRBUD6vjTmQHFTW9TBr4XV4qAIlLJOLLhhX23NdthLxXQn/ZVZlY1xOFone+H OBymLVIdYYNcO4/DoZqc6h8/HkOh9pLfVPNeoV/7PqrwxhukgyHWV+o8/embvVJB4EN8 WdlB7v3yrseJKgVnqKuAMBABaL1cHukSbxmj4Z5GYNudxagucqSbS1809MbUsgvgNx9f uDrwO8wFAMxwMOY3kQRVdOAgETqhqC4oavM4C9U7pIhNCRM8dqhBTrefxPlR+M+KD/uj JOcQ== X-Gm-Message-State: ALoCoQkdagYMybXxyKVPK72Q4opIJ1mcoeuBsAfPRkdt/LTjfhcB2WXuu62wjfXEKm5sRReZRcJn X-Received: by 10.194.60.73 with SMTP id f9mr2467590wjr.6.1436976033871; Wed, 15 Jul 2015 09:00:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.2 with SMTP id ls2ls230357lac.51.gmail; Wed, 15 Jul 2015 09:00:33 -0700 (PDT) X-Received: by 10.112.55.207 with SMTP id u15mr4879845lbp.88.1436976033583; Wed, 15 Jul 2015 09:00:33 -0700 (PDT) Received: from mail-lb0-x22a.google.com (mail-lb0-x22a.google.com. [2a00:1450:4010:c04::22a]) by mx.google.com with ESMTPS id p5si4361434lap.109.2015.07.15.09.00.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jul 2015 09:00:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22a as permitted sender) client-ip=2a00:1450:4010:c04::22a; Received: by lblf12 with SMTP id f12so27738166lbl.2 for ; Wed, 15 Jul 2015 09:00:32 -0700 (PDT) X-Received: by 10.112.166.106 with SMTP id zf10mr4927052lbb.36.1436976032941; Wed, 15 Jul 2015 09:00:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp3185223lbb; Wed, 15 Jul 2015 09:00:31 -0700 (PDT) X-Received: by 10.107.150.141 with SMTP id y135mr5424890iod.38.1436976031117; Wed, 15 Jul 2015 09:00:31 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id yv1si8312047pac.33.2015.07.15.09.00.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jul 2015 09:00:31 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-403040-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 53882 invoked by alias); 15 Jul 2015 16:00:12 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 53868 invoked by uid 89); 15 Jul 2015 16:00:12 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f171.google.com Received: from mail-yk0-f171.google.com (HELO mail-yk0-f171.google.com) (209.85.160.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 15 Jul 2015 16:00:06 +0000 Received: by ykdu72 with SMTP id u72so40175790ykd.2 for ; Wed, 15 Jul 2015 09:00:04 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.170.53.79 with SMTP id 76mr5018363ykv.68.1436976004004; Wed, 15 Jul 2015 09:00:04 -0700 (PDT) Received: by 10.37.88.137 with HTTP; Wed, 15 Jul 2015 09:00:03 -0700 (PDT) Date: Wed, 15 Jul 2015 21:30:03 +0530 Message-ID: Subject: [genmatch] reject empty c_expr From: Prathamesh Kulkarni To: Richard Biener , gcc Patches X-IsSubscribed: yes X-Original-Sender: prathamesh.kulkarni@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22a as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 Hi, We allow c_expr to be empty which accepts cases like the following: (simplify match-operand (if () result-operand)) (simplify match-operand {}) The attached patch rejects empty c_expr. Ok for trunk after bootstrap + test ? Thank you, Prathamesh 2015-07-15 Prathamesh Kulkarni * genmatch.c (parse_c_expr): Reject empty c_expr. Index: genmatch.c =================================================================== --- genmatch.c (revision 225834) +++ genmatch.c (working copy) @@ -3375,6 +3375,7 @@ unsigned opencnt; vec code = vNULL; unsigned nr_stmts = 0; + bool empty = true; eat_token (start); if (start == CPP_OPEN_PAREN) end = CPP_CLOSE_PAREN; @@ -3394,6 +3395,7 @@ && --opencnt == 0) break; + empty = false; /* This is a lame way of counting the number of statements. */ if (token->type == CPP_SEMICOLON) nr_stmts++; @@ -3412,6 +3414,10 @@ code.safe_push (*token); } while (1); + + if (empty) + fatal_at (token, "c_expr cannot be empty"); + return new c_expr (r, code, nr_stmts, vNULL, capture_ids); }