From patchwork Mon May 18 23:24:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 48725 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A07DC21411 for ; Mon, 18 May 2015 23:25:20 +0000 (UTC) Received: by wixv7 with SMTP id v7sf501074wix.0 for ; Mon, 18 May 2015 16:25:19 -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=018NGaQkgnapFbX6vq6blN4DxpReDbO/nyYLUlYybq4=; b=El+kW1zyWplnaJvqdwJDd+Bc08VN80KVu9sYbyJ3DFCBFI/t2+x1e8DvfNd2c0Kcxr AYC+YUSMx/befHGT5brXGWjLTPYXglf3h2Ry6DpEnLbxz8qkKthffvLzwafWybTz4b31 +wcyf8jMW/Tr0YNFG9OihVofR6Zh0BZxXCL1TT0kQRIZQByGZLKRN8TKOS/szhobXHBY jTaeRjNp5tAD+jFaqIQ9jF9WeMiQWiuEjHz59qwKYhjr6q0zBP28nA9fWwY+MdTusmvp IC8IzPurMf2hpEpGQeYAd8V4BUU3gMUKYnXpe2+K8h/EqKRGLS8KW6C3k3KQ7DjkM/r8 YiGg== X-Gm-Message-State: ALoCoQlsMcRmzbwJEv9NoYmrk43ykg/X/pu4ebtRGMjD6ztIrT8z0JvUrnKmf6/jFHmQ2/NBIFPC X-Received: by 10.112.13.200 with SMTP id j8mr19632754lbc.14.1431991519923; Mon, 18 May 2015 16:25:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.229 with SMTP id uh5ls226929lac.37.gmail; Mon, 18 May 2015 16:25:19 -0700 (PDT) X-Received: by 10.112.135.131 with SMTP id ps3mr19000483lbb.84.1431991519778; Mon, 18 May 2015 16:25:19 -0700 (PDT) Received: from mail-la0-x230.google.com (mail-la0-x230.google.com. [2a00:1450:4010:c03::230]) by mx.google.com with ESMTPS id jj4si7602213lbb.174.2015.05.18.16.25.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 May 2015 16:25:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::230 as permitted sender) client-ip=2a00:1450:4010:c03::230; Received: by lagv1 with SMTP id v1so242095217lag.3 for ; Mon, 18 May 2015 16:25:19 -0700 (PDT) X-Received: by 10.153.6.36 with SMTP id cr4mr19584303lad.56.1431991519316; Mon, 18 May 2015 16:25:19 -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 hn6csp394899lbb; Mon, 18 May 2015 16:25:17 -0700 (PDT) X-Received: by 10.70.90.129 with SMTP id bw1mr48504671pdb.85.1431991516571; Mon, 18 May 2015 16:25:16 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id fj8si18102457pdb.93.2015.05.18.16.25.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 May 2015 16:25:16 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-398197-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 70350 invoked by alias); 18 May 2015 23:25:00 -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 70337 invoked by uid 89); 18 May 2015 23:24:59 -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-la0-f48.google.com Received: from mail-la0-f48.google.com (HELO mail-la0-f48.google.com) (209.85.215.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 18 May 2015 23:24:58 +0000 Received: by lagv1 with SMTP id v1so242085207lag.3 for ; Mon, 18 May 2015 16:24:54 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.20.200 with SMTP id p8mr9680048lae.69.1431991494429; Mon, 18 May 2015 16:24:54 -0700 (PDT) Received: by 10.25.205.146 with HTTP; Mon, 18 May 2015 16:24:54 -0700 (PDT) Date: Tue, 19 May 2015 04:54:54 +0530 Message-ID: Subject: [match-and-simplify] report error for invalid operator-lists 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:c03::230 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, genmatch segfaults on: (define_operator_list op (plus)) The above syntax is invalid, and it segfaults on: fatal_error (token, "operator list is empty"); because token is NULL. The patch puts a check for CPP_CLOSE_PAREN after parsing id-list. OK for trunk after bootstrap+testing completes ? Thanks, Prathamesh 2015-05-19 Prathamesh Kulkarni * genmatch.c (parser::parse_operator_list): Check for CPP_CLOSE_PAREN after end of id-list. Index: genmatch.c =================================================================== --- genmatch.c (revision 223294) +++ genmatch.c (working copy) @@ -3427,6 +3427,11 @@ op->substitutes.safe_push (idb); } + // Check that there is no junk after id-list + token = peek(); + if (token->type != CPP_CLOSE_PAREN) + fatal_at (token, "expected identifier got %s", cpp_type2name (token->type, 0)); + if (op->substitutes.length () == 0) fatal_at (token, "operator-list cannot be empty");