From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27190 invoked by alias); 1 May 2017 18:04:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 26274 invoked by uid 89); 1 May 2017 18:04:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=U*maltsevm, sk:maltsev, maltsevmgmailcom, maltsevm@gmail.com X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 01 May 2017 18:04:12 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37425) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d5FgD-0003ZF-5t for gcc-patches@gnu.org; Mon, 01 May 2017 14:04:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5FgB-0003F4-MN for gcc-patches@gnu.org; Mon, 01 May 2017 14:04:12 -0400 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]:34100) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d5FgB-0003Eu-BL for gcc-patches@gnu.org; Mon, 01 May 2017 14:04:11 -0400 Received: by mail-lf0-x22b.google.com with SMTP id t144so63587030lff.1 for ; Mon, 01 May 2017 11:04:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version; bh=OH2TTsjLxvmT+86udemuFCQnO/jwIoWtsCjXdKCEoWU=; b=ZSF8xfO28jdNmpVox4pB/yYy3SL/8Fnl+7qYwQFWly1wHS6NyC45F8R/tEaCbjR+sK kP5yPXwfVveDNDcGFwkCUmpBjR361ytIE1rlJpwEz4vnwckY0js5SHBmN5DzhaLdl/78 JppnpgidhOdszpMpiTp8ExbUfKGA3qnwkY8/PHlVsJ1V56ljP8rOOCfwKMh2HDoHEkEV LIv3/rquyZY3iidc3bQ87wfghnELvW4hdf+QZZ+7h7l+Kc5Ek/npxHi3CO9k4yNQIeRi HMKPlhQDuVCa2X7+E18/jOP4i1jtJafhxmq7gzjkaMSkHsbAiW0ePV7I/3Vy22TnYZNL yH6g== X-Gm-Message-State: AN3rC/5vWKXjejspq27nSp5LCPPtCxhSwvGRuEN5f4RSYs2LxRZFoZcK f1SjEvvl76hGTw== X-Received: by 10.46.88.76 with SMTP id x12mr9551026ljd.90.1493661850071; Mon, 01 May 2017 11:04:10 -0700 (PDT) Received: from [192.168.123.200] ([77.41.78.126]) by smtp.gmail.com with ESMTPSA id r38sm2843839lfi.67.2017.05.01.11.04.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 May 2017 11:04:09 -0700 (PDT) To: gcc-patches , Richard Biener , Prathamesh Kulkarni From: Mikhail Maltsev Subject: [PATCH 1/5][GIMPLE FE] PR testsuite/80580. Handle missing labels in goto statements Message-ID: <9e3b3ee6-0c67-f974-c38e-7f9f25249914@gmail.com> Date: Mon, 01 May 2017 18:04:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------886AD033883996CBB9B64FBF" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::22b X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg00027.txt.bz2 This is a multi-part message in MIME format. --------------886AD033883996CBB9B64FBF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 733 The first problem happens because we don't check for missing labels when parsing 'goto' statements. I.e.: __GIMPLE() void fn1() { if (1) goto } The fix is pretty obvious: just add a check. My question is: which functions should I use to produce diagnostics? The surrounding code uses 'c_parser_error', but this function does not handle locations very well (in fact, it uses input_location). -- Regards, Mikhail Maltsev gcc/testsuite/ChangeLog: 2017-05-01 Mikhail Maltsev * gcc.dg/gimplefe-error-4.c: New test. * gcc.dg/gimplefe-error-5.c: New test. gcc/c/ChangeLog: 2017-05-01 Mikhail Maltsev * gimple-parser.c (c_parser_gimple_if_stmt): Check for empty labels. --------------886AD033883996CBB9B64FBF Content-Type: text/plain; charset=UTF-8; name="0001-GIMPLEFE-handle-missing-labels-in-goto-statements.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0="0001-GIMPLEFE-handle-missing-labels-in-goto-statements.patch" Content-length: 3270 RnJvbSAwNzQ1M2JhMWJmMGIxMjkwY2VmNTRkY2IwMjhjYjQ3N2IxNzk2NmRm IE1vbiBTZXAgMTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBNaWtoYWlsIE1hbHRz ZXYgPG1hbHRzZXZtQGdtYWlsLmNvbT4KRGF0ZTogRnJpLCAyNCBGZWIgMjAx NyAxMzowOToxMCArMDMwMApTdWJqZWN0OiBbUEFUQ0ggMS81XSBHSU1QTEVG RTogaGFuZGxlIG1pc3NpbmcgbGFiZWxzIGluIGdvdG8gc3RhdGVtZW50cwoK LS0tCiBnY2MvYy9naW1wbGUtcGFyc2VyLmMgICAgICAgICAgICAgICAgICAg fCAxMCArKysrKysrKysrCiBnY2MvdGVzdHN1aXRlL2djYy5kZy9naW1wbGVm ZS1lcnJvci00LmMgfCAgNyArKysrKysrCiBnY2MvdGVzdHN1aXRlL2djYy5k Zy9naW1wbGVmZS1lcnJvci01L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