lkml.org 
[lkml]   [2022]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes")
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,
\
 
 \ /
  Last update: 2022-08-11 20:33    [W:0.058 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site