[PATCH v2 3/5] stdio: Fix tst-vfprintf-user-type on clang
Adhemerval Zanella
adhemerval.zanella@linaro.org
Fri Dec 19 18:52:22 GMT 2025
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
More information about the Libc-alpha
mailing list