Skip to content

Build error -Werror=stringop-overflow in util/qemu-thread-posix.c

Building git HEAD or v6.0.0 both produce an error when building with GCC gcc (Debian 11-20210327-1) 11.0.1 20210327 on Debian Bullseye:

In file included from /usr/include/glib-2.0/glib/deprecated/gthread.h:124,
                 from /usr/include/glib-2.0/glib.h:111,
                 from /home/user/qemu/include/glib-compat.h:32,
                 from /home/user/qemu/include/qemu/osdep.h:132,
                 from ../util/qemu-thread-posix.c:13:
../util/qemu-thread-posix.c: In function ‘qemu_thread_start’:
../util/qemu-thread-posix.c:520:5: error: ‘__sigsetjmp’ accessing 200 bytes in a region of size 72 [-Werror=stringop-overflow=]
  520 |     pthread_cleanup_push(qemu_thread_atexit_notify, NULL);
      |     ^~~~~~~~~~~~~~~~~~~~
../util/qemu-thread-posix.c:520:5: note: referencing argument 1 of type ‘struct __jmp_buf_tag *’
/usr/include/pthread.h:719:12: note: in a call to function ‘__sigsetjmp’
  719 | extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
      |            ^~~~~~~~~~~
cc1: all warnings being treated as errors
[649/8642] Compiling C object libqemuutil.a.p/qobject_json-lexer.c.o
[650/8642] Compiling C object tests/qtest/libqos/libqos.fa.p/qos_external.c.o
[651/8642] Compiling C object libqemuutil.a.p/qobject_block-qdict.c.o
[652/8642] Compiling C object libqemuutil.a.p/util_async.c.o
[653/8642] Compiling C object tests/qtest/libqos/libqos.fa.p/.._libqtest.c.o
[654/8642] Compiling C object libqemu-cris-softmmu.fa.p/tcg_tcg-op-gvec.c.o
[655/8642] Compiling C object libqemu-cris-softmmu.fa.p/tcg_tcg-op.c.o
ninja: build stopped: subcommand failed.
make[1]: *** [Makefile:154: run-ninja] Error 1
make[1]: Leaving directory '/home/user/qemu/build'
make: *** [GNUmakefile:11: all] Error 2
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information