From: Adhemerval Zanella Date: Thu, 24 Apr 2025 20:15:39 +0000 (-0300) Subject: stdio: Fix test-printf-ldbl-compat.c build with ubsan X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=967c9fd3ebc14ae994b9ed428df503ea476cf801;p=thirdparty%2Fglibc.git stdio: Fix test-printf-ldbl-compat.c build with ubsan On powercp64le with --enable-ubsan the build fails with: In file included from ../include/bits/stdio2.h:1, from ../libio/stdio.h:967, from ../include/stdio.h:14, from ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c:21, from ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ieee128.c:1: In function ‘vfprintf’, inlined from ‘do_test_call_varg’ at ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c:56:3: ../libio/bits/stdio2.h:166:10: error: null format string [-Werror=format-overflow=] 166 | return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function ‘vsnprintf’, inlined from ‘do_test_call_varg’ at ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c:68:3: ../libio/bits/stdio2.h:100:10: error: null format string [-Werror=format-truncation=] 100 | return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 101 | __glibc_objsize (__s), __fmt, __ap); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function ‘fprintf’, inlined from ‘do_test_call_rarg.constprop’ at ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c:104:3: ../libio/bits/stdio2.h:111:10: error: null format string [-Werror=format-overflow=] 111 | return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~ In function ‘printf’, inlined from ‘do_test_call_rarg.constprop’ at ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c:108:3: ../libio/bits/stdio2.h:118:10: error: null format string [-Werror=format-overflow=] 118 | return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function ‘snprintf’, inlined from ‘do_test_call_rarg.constprop’ at ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c:112:3: ../libio/bits/stdio2.h:68:10: error: null format string [-Werror=format-truncation=] 68 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 69 | __glibc_objsize (__s), __fmt, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 70 | __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors --- diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c index 0bd40c3aed..7276535106 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c +++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c @@ -25,6 +25,7 @@ #include static void +__attribute_disable_usbsan__ do_test_call_varg (FILE *stream, const char *format, ...) { char *buffer = NULL; @@ -79,6 +80,7 @@ do_test_call_varg (FILE *stream, const char *format, ...) } static void +__attribute_disable_usbsan__ do_test_call_rarg (FILE *stream, const char *format, long double ld, double d) { char *buffer = NULL;