[PATCH v2 3/5] stdio: Fix tst-vfprintf-user-type on clang

H.J. Lu hjl.tools@gmail.com
Sat Dec 20 00:00:01 GMT 2025


On Sat, Dec 20, 2025 at 2:54 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> The pointer alias comparison will be optimized away by the compiler,
> so use an indirection point to prevent it (similar to
> malloc/tst-malloc-aux.h).
> ---
>  stdio-common/tst-vfprintf-user-type.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/stdio-common/tst-vfprintf-user-type.c b/stdio-common/tst-vfprintf-user-type.c
> index 3fc98b30f1..3bcca88974 100644
> --- a/stdio-common/tst-vfprintf-user-type.c
> +++ b/stdio-common/tst-vfprintf-user-type.c
> @@ -183,7 +183,9 @@ do_test (void)
>  #else
>    extern int asprintf_alias (char **, const char *, ...) __asm__ ("asprintf");
>  #endif
> -  TEST_VERIFY (asprintf_alias == asprintf);
> +  static __typeof (asprintf) * volatile asprintf_indirect = asprintf;
> +  TEST_VERIFY (asprintf_alias == asprintf_indirect);
> +
>    char *str = NULL;
>    TEST_VERIFY (asprintf_alias (&str, "[[%P]]", 123L, 456.0) >= 0);
>    TEST_COMPARE_STRING (str, "[[(123, 456.000000)]]");
> --
> 2.43.0
>

LGTM.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Thanks.

-- 
H.J.


More information about the Libc-alpha mailing list