]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
stdio: Fix tst-vfprintf-user-type on clang
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 19 Dec 2025 18:52:22 +0000 (15:52 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 22 Dec 2025 18:55:23 +0000 (15:55 -0300)
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).

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
stdio-common/tst-vfprintf-user-type.c

index 3fc98b30f12f1550bc0cb46b0ffdce614d27bc41..3bcca889743bebe517be449ea01601837208c513 100644 (file)
@@ -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)]]");