linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes")
@ 2022-08-11 17:22 Sudip Mukherjee (Codethink)
  2022-08-11 18:31 ` Nathan Chancellor
  2022-08-11 18:33 ` Stefano Garzarella
  0 siblings, 2 replies; 5+ messages in thread
From: Sudip Mukherjee (Codethink) @ 2022-08-11 17:22 UTC (permalink / raw)
  To: Stefano Garzarella, Michael S. Tsirkin, Jason Wang
  Cc: virtualization, linux-kernel, Nathan Chancellor,
	clang-built-linux, linux-next

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.


--
Regards
Sudip

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes")
  2022-08-11 17:22 build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes") Sudip Mukherjee (Codethink)
@ 2022-08-11 18:31 ` Nathan Chancellor
  2022-08-11 18:50   ` Stefano Garzarella
  2022-08-11 20:54   ` Nathan Chancellor
  2022-08-11 18:33 ` Stefano Garzarella
  1 sibling, 2 replies; 5+ messages in thread
From: Nathan Chancellor @ 2022-08-11 18:31 UTC (permalink / raw)
  To: Sudip Mukherjee (Codethink)
  Cc: Stefano Garzarella, Michael S. Tsirkin, Jason Wang,
	virtualization, linux-kernel, clang-built-linux, linux-next

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,

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes")
  2022-08-11 17:22 build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes") Sudip Mukherjee (Codethink)
  2022-08-11 18:31 ` Nathan Chancellor
@ 2022-08-11 18:33 ` Stefano Garzarella
  1 sibling, 0 replies; 5+ messages in thread
From: Stefano Garzarella @ 2022-08-11 18:33 UTC (permalink / raw)
  To: Sudip Mukherjee (Codethink)
  Cc: Michael S. Tsirkin, Jason Wang, virtualization, linux-kernel,
	Nathan Chancellor, clang-built-linux, linux-next

Hi Sudip,

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.

Thanks for the report, I already re-sent a new series with that patch 
fixed:
https://lore.kernel.org/virtualization/20220811083632.77525-1-sgarzare@redhat.com/T/#t

And it looks like it's already in Michael's tree:
https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next

Thanks,
Stefano


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes")
  2022-08-11 18:31 ` Nathan Chancellor
@ 2022-08-11 18:50   ` Stefano Garzarella
  2022-08-11 20:54   ` Nathan Chancellor
  1 sibling, 0 replies; 5+ messages in thread
From: Stefano Garzarella @ 2022-08-11 18:50 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Sudip Mukherjee (Codethink),
	Michael S. Tsirkin, Jason Wang, virtualization, linux-kernel,
	clang-built-linux, linux-next

On Thu, Aug 11, 2022 at 11:31:21AM -0700, Nathan Chancellor wrote:
>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

Interesting, I confirm that also gcc 12 does not warns/error.
This is my version:

     $ gcc --version
     gcc (GCC) 12.1.1 20220507 (Red Hat 12.1.1-1)

>
>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.

Yep, that was the fix and I already re-sent a new series with the patch
fixed:
https://lore.kernel.org/virtualization/20220811083632.77525-1-sgarzare@redhat.com/T/#t

Michael already queued the new version in his tree:
https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next

Thanks,
Stefano


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes")
  2022-08-11 18:31 ` Nathan Chancellor
  2022-08-11 18:50   ` Stefano Garzarella
@ 2022-08-11 20:54   ` Nathan Chancellor
  1 sibling, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2022-08-11 20:54 UTC (permalink / raw)
  To: Sudip Mukherjee (Codethink)
  Cc: Stefano Garzarella, Michael S. Tsirkin, Jason Wang,
	virtualization, linux-kernel, clang-built-linux, linux-next

On Thu, Aug 11, 2022 at 11:31:21AM -0700, Nathan Chancellor wrote:
> 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.

Just for the record, it was:

https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=8b7a9a249a63e066cff6e95db05a3158b4cc56cc

The clang developers are aware, it seems it will get implemented at some
point:

https://github.com/llvm/llvm-project/issues/56040

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-11 20:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 17:22 build failure of next-20220811 due to d79b32c2e4a4 ("vdpa_sim_blk: add support for discard and write-zeroes") Sudip Mukherjee (Codethink)
2022-08-11 18:31 ` Nathan Chancellor
2022-08-11 18:50   ` Stefano Garzarella
2022-08-11 20:54   ` Nathan Chancellor
2022-08-11 18:33 ` Stefano Garzarella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).