23.10.2021 19:33, Lucas Nussbaum wrote:
Source: qemu
Version: 1:6.1+dfsg-6
Severity: serious
Justification: FTBFS
Tags: bookworm sid ftbfs
User: lu...@debian.org
Usertags: ftbfs-20211023 ftbfs-bullseye

Hi,

During a rebuild of all packages in sid, your package failed to build
on amd64.


Relevant part (hopefully):
powerpc64-linux-gnu-gcc $EXTRACFLAGS -m32 -mcpu=604 -msoft-float -fno-builtin-bcopy -fno-builtin-log2 -Os -g 
-DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS -Wall -Wredundant-decls -Wshadow -Wpointer-arith 
-Wstrict-prototypes -Wmissing-declarations -Wundef -Wendif-labels -Wstrict-aliasing -Wwrite-strings 
-Wmissing-prototypes -Wnested-externs -Werror -MMD -MP -MT target/drivers/usbohci_rh.o -MF 
'target/drivers/usbohci_rh.d' -I/<<PKGBUILDDIR>>/roms/openbios/include 
-I/<<PKGBUILDDIR>>/roms/openbios/kernel/include -I./target/include -c -o target/drivers/usbohci_rh.o 
/<<PKGBUILDDIR>>/roms/openbios/drivers/usbohci_rh.c
/<<PKGBUILDDIR>>/roms/openbios/drivers/usb.c: In function ‘get_descriptor’:
/<<PKGBUILDDIR>>/roms/openbios/drivers/usb.c:200:23: error: array subscript 
‘device_descriptor_t[0]’ is partly outside array bounds of ‘u8[8]’ {aka ‘unsigned char[8]’} 
[-Werror=array-bounds]
   200 |                 if (dd->bMaxPacketSize0 != 0)
       |                       ^~
/<<PKGBUILDDIR>>/roms/openbios/drivers/usb.c:181:12: note: while referencing 
‘buf’
   181 |         u8 buf[8];
       |            ^~~

This is interesting. And I'm not really sure what to do with this.
The code is right, and gcc is too picky there. The thing is,
while the buffer is indeed smaller than the size of the structure
to which it is casted there, but the actual code does not access
past the buffer, bMaxPacketSize0 is byte #7 (counting from 0) there
which is exactly the last byte of buf[] array.

I haven't seen this warning before, it must be some new gcc
addition, and gcc is being too smart there :)

I agree the code is cloudy there, it can have been written
more clearly. So I can't say this is really a bug in gcc,
it is like classic "variable can be used uninitialized" while
it actually is not, for example because all relevant switch(){}
statements leads to return but gcc can not figure it out.

Thanks,

/mjt

Reply via email to