From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by sourceware.org (Postfix) with ESMTPS id 0AAD93858C60 for ; Mon, 20 Sep 2021 15:41:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0AAD93858C60 Received: by mail-pj1-x102c.google.com with SMTP id f3-20020a17090a638300b00199097ddf1aso15542415pjj.0 for ; Mon, 20 Sep 2021 08:41:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=FeeiYYBIvV/KA6min2TJfNeHtINrLYVxO43EUmWzzbU=; b=j8SQbmIUZKGbbuCgCIjeTZZJKNYKiKMPsW7cz5I3ZvkCiA/cTt5b8hxDIlh0xokz1M feZnRiin8Y4F8+8UrCTYwXAnjXqrru9sO6xpfN6vR71FmQjCfUessmZ34FfWl8laiYop S7osCbguWvnfQupad9jSYJEg6vo/wmcozMC3vuOpY/uR8mTcPFVPu57nRoSxtYZUxgIa Tttt85yxvx4n5gYHK3QK6Ufh6Zhb4F4sQQHyscJ9yn1xorqgQ7ujGGgKL2udoF03KOMj 3pYMtIFHkBdISpqsmCiuHC8suNidR9iYJvDTFrkEyOTiUR8Rt91t3tIjy6AR6VcrE8ND /tvA== X-Gm-Message-State: AOAM530uIsHY0nNghiI81d/V1fAx3YEM/RtCzsVpz65YOjYL2sli6eal UYFH6ZnJsZmmCnZUNks5z0GRcUIjSHs= X-Google-Smtp-Source: ABdhPJwMQGkIZalyQI1UmihN9OmMd+IZFBPz+D5aXrmXqmrwT7IqwpOa//Occ0oGVfjxetdA5W/1lw== X-Received: by 2002:a17:90b:4a4c:: with SMTP id lb12mr38155864pjb.55.1632152464740; Mon, 20 Sep 2021 08:41:04 -0700 (PDT) Received: from [172.31.0.175] (c-98-202-48-222.hsd1.ut.comcast.net. [98.202.48.222]) by smtp.gmail.com with ESMTPSA id x16sm15643666pgc.49.2021.09.20.08.41.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Sep 2021 08:41:04 -0700 (PDT) Subject: Re: [PATCH] c: [PR32122] Require pointer types for computed gotos To: apinski@marvell.com, gcc-patches@gcc.gnu.org References: <1632111261-18790-1-git-send-email-apinski@marvell.com> From: Jeff Law Message-ID: <6c94af85-7948-b498-73bb-e2b4f1500581@gmail.com> Date: Mon, 20 Sep 2021 09:41:03 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <1632111261-18790-1-git-send-email-apinski@marvell.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2021 15:41:07 -0000 On 9/19/2021 10:14 PM, apinski--- via Gcc-patches wrote: > From: Andrew Pinski > > So GCC has always accepted non-pointer types in computed gotos but > that was wrong based on the documentation: > Any expression of type void * is allowed. > > So this fixes the problem by requiring the type to > be a pointer type. > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. > > PR c/32122 > > gcc/c/ChangeLog: > > * c-parser.c (c_parser_statement_after_labels): Pass > the c_expr instead of the tree to c_finish_goto_ptr. > * c-typeck.c (c_finish_goto_ptr): Change the second > argument type to c_expr. > * c-tree.h (c_finish_goto_ptr): Likewise. > Error out if the expression was not of a pointer type. > > gcc/testsuite/ChangeLog: > > * gcc.dg/comp-goto-5.c: New test. > * gcc.dg/comp-goto-6.c: New test. OK jeff