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>
#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)]]");