ubsan causes wrong -Wformat-overflow warnings as follows: In file included from /usr/include/stdio.h:906, from /home/alarm/q/var/qemu/include/qemu/osdep.h:114, from ../disas/cris.c:21: In function 'sprintf', inlined from 'format_dec' at ../disas/cris.c:1737:3, inlined from 'print_with_operands' at ../disas/cris.c:2477:12, inlined from 'print_insn_cris_generic.constprop' at ../disas/cris.c:2690:8: /usr/include/bits/stdio2.h:30:10: warning: null destination pointer [-Wformat-overflow=] 30 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 31 | __glibc_objsize (__s), __fmt, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32 | __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~
Don't let these errors stop the build. Signed-off-by: Akihiko Odaki <akihiko.od...@daynix.com> --- meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index d7d841e71e..02f1a18080 100644 --- a/meson.build +++ b/meson.build @@ -365,7 +365,9 @@ if get_option('sanitizers') # Detect static linking issue with ubsan - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285 if cc.links('int main(int argc, char **argv) { return argc + 1; }', args: [qemu_ldflags, '-fsanitize=undefined']) - qemu_cflags = ['-fsanitize=undefined'] + qemu_cflags + # 87884 – ubsan causes wrong -Wformat-overflow warning + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87884 + qemu_cflags = ['-fsanitize=undefined', '-Wno-error=format-overflow'] + qemu_cflags qemu_ldflags = ['-fsanitize=undefined'] + qemu_ldflags endif endif -- 2.42.1