On Thu, Oct 05, 2023 at 11:28:49AM +0200, Martin Husemann wrote:
> This breaks the build:
> 
> ../../../../kern/kern_synch.c: In function 'kpause':
> ../../../../kern/kern_synch.c:257:10: error: 'nlocks' may be used 
> uninitialized in this function [-Werror=maybe-uninitialized]
>   257 |  error = sleepq_block(timo, intr, &kpause_syncobj, nlocks);
>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> 
> and it looks like gcc is totally correct here: KERNEL_UNLOCK_ALL()
> does not set nlocks but KERNEL_LOCK() later KASSERTS it is > 0.

No, I was confused by the #ifdef maze - it breaks the build for 
non-MULTIPROCESSOR kernels only, and I am not actually sure what "use"
gcc sees for the "nlocks" variable at all in that case.

Martin

Reply via email to