Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp898526rwb; Thu, 11 Aug 2022 11:55:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR4pPbS+g/PKNZFe11vgwkb8HH49V2Jm34Mupmq/JkuHHv8mUyaQSxxchVYpS39bJbeeHo25 X-Received: by 2002:a17:907:b0d:b0:730:aa17:a0b7 with SMTP id h13-20020a1709070b0d00b00730aa17a0b7mr268579ejl.661.1660244100724; Thu, 11 Aug 2022 11:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660244100; cv=none; d=google.com; s=arc-20160816; b=crKMzQJdvp9dIEvaUIDZ7/79hDPE0rugtZRbPTQ+LnP/EIQNWuPe8uC60pYQDBV8Vb Krh+j1QZ2eRavHJZgNUjSHCtfPc9e2+C8ecrq5zWw1WxbBzDqHEsEY9uKyknkygg8DW8 BjNUN4IlFFdfis5U7Zm0dcsah2jjIFuTTJVoqtKGLrqe9+JkUihF6xnRboWM8KuD0oQ8 rPk0J6e3c2yx0zUu6Ut73K4ziT7rcOAzU4+AGHKGJm8qnsoE97LwBIRJI58NmQYS/sNJ LH7CPi+11Q60fryGdxsM5tV6DulsUEK0ScP7t3AjWTPQdlajuv6EdQmARDYT/66GwqDD GY/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=21eQWQ8RDFTDzNNSLpFPo8J9EHcfEWkL6aYSJ5pJhVk=; b=MIljOWjBkRRfdHYmhkx/q09IjNucuJCnZ8SOBaa8GBGJrY4+ZgsjbFe2X6U0c8mwN9 AyINKI9dFba7s7khqmvEoabapRpt9shd/xzdVGxesnGpfM1jo3WNXAG44dqtqLzPqS+u v94AcMhunPZwxxkT+UiZU2XgJVa2S/uOfm9CJ8gitwN7tyoi6TYAUsQpyNK9q1gvOPBJ zDq5M5ihVhtkr+ocb8bugM3Ep8h9LkODlfuyRqyhX8w3ujzC7rOrgu6ql0tpsY1t/wi3 K6jN2So/Wg2DxuHx7/aeKiL6OuSygywv6zYmGLk0m+M7OHk5vG/N2e2GDcXzBfNqF24J /ZLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KOYlUH6L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j18-20020a05640211d200b0043e47007ba4si202045edw.254.2022.08.11.11.54.35; Thu, 11 Aug 2022 11:55:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KOYlUH6L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235731AbiHKSb3 (ORCPT + 99 others); Thu, 11 Aug 2022 14:31:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235636AbiHKSb1 (ORCPT ); Thu, 11 Aug 2022 14:31:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D1F66D9FD; Thu, 11 Aug 2022 11:31:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AEC45B82187; Thu, 11 Aug 2022 18:31:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 093F3C433C1; Thu, 11 Aug 2022 18:31:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660242683; bh=lkARARzWQLa6i9JTMh4hY0BpWadzELasXTHngRGpmZY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KOYlUH6L6VBnX9tFgi/D9JA2iIOR42RuG5uUtrrlKIi4K2ig3qvZJJyII63BeTLox AHqS4BoEKCw7YfZk8HTG6l+1WvjiAARWkwjEqL1Hg+TsEoE4XKYXzWPtXW17Yr5n3Q YmBNczlFmivLLHXI1lbIfoE9/FxKquCvXa2kTYWCkackrJIfhFBCoQyejF8WlAY/wA ogZAErqbROEmHfeRC9kdjRuyGXUJ9fvCkREpOxywcCnAF9lhSb5i4pGJLA3IWgEH/h q+Iysee8LcypbRgziymGoRHPnK3tVgdBiD4G9iIIyFvQvOCPK31bo4C32AMFn9IbGP NHwK2aF+YcLpw== Date: Thu, 11 Aug 2022 11:31:21 -0700 From: Nathan Chancellor To: "Sudip Mukherjee (Codethink)" Cc: Stefano Garzarella , "Michael S. Tsirkin" , Jason Wang , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, clang-built-linux , linux-next@vger.kernel.org Subject: Re: build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes") Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 11, 2022 at 06:22:54PM +0100, Sudip Mukherjee (Codethink) wrote: > Hi All, > > Not sure if it has been reported, builds of arm64 with clang failed to > build next-20220811 with the error: > > drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:201:3: error: expected expression > struct virtio_blk_discard_write_zeroes range; > ^ > drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:204:25: error: use of undeclared identifier 'range' > if (to_pull != sizeof(range)) { > ^ > drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:207:21: error: use of undeclared identifier 'range' > to_pull, sizeof(range)); > ^ > drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:212:60: error: use of undeclared identifier 'range' > bytes = vringh_iov_pull_iotlb(&vq->vring, &vq->out_iov, &range, > ^ > drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:222:38: error: use of undeclared identifier 'range' > sector = vdpasim64_to_cpu(vdpasim, range.sector); > ^ > drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:224:43: error: use of undeclared identifier 'range' > num_sectors = vdpasim32_to_cpu(vdpasim, range.num_sectors); > ^ > drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:225:37: error: use of undeclared identifier 'range' > flags = vdpasim32_to_cpu(vdpasim, range.flags); > ^ > drivers/vdpa/vdpa_sim/vdpa_sim_blk.c:202:7: error: mixing declarations and code is incompatible with standards before C99 [-Werror,-Wdeclaration-after-statement] > u32 num_sectors, flags; > ^ > 8 errors generated. > > > git bisect pointed to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes"). > And, reverting that commit has fixed the build failure. > > I will be happy to test any patch or provide any extra log if needed. I am very surprised GCC does not error out in the same way, since as far as I understand it, labeled statements have to be followed by a statement and a declaration is not a statement in C so braces are needed. In fact, it seems like something changed (regressed?) between GCC 10.x and 11.x? https://godbolt.org/z/EYaGa1eE3 I am going to bisect GCC to find out whether or not that was intentional. At any rate, isn't this the proper fix? I can send it as a formal patch if desired. Cheers, Nathan diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c index db85df1d5073..067d4c2f7bf4 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim_blk.c @@ -197,7 +197,7 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim, break; case VIRTIO_BLK_T_DISCARD: - case VIRTIO_BLK_T_WRITE_ZEROES: + case VIRTIO_BLK_T_WRITE_ZEROES: { struct virtio_blk_discard_write_zeroes range; u32 num_sectors, flags; @@ -253,6 +253,7 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim, } break; + } default: dev_dbg(&vdpasim->vdpa.dev,