I noticed a crash in a program using glob, on a line that calls mempcpy. I then noticed the following:
glob.c:836:21: warning: implicit declaration of function 'mempcpy' is invalid in C99 [-Wimplicit-function-declaration]
d = mempcpy (dirname, p->pw_dir, home_len);
^
glob.c:836:19: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
d = mempcpy (dirname, p->pw_dir, home_len);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(and a bunch of other warnings). So I think this explains the crash.
The reason this happens is that mempcpy is only declared in Android's string.h #if __ANDROID_API__ >= 23
I see that the availability of this and many other Android APIs is documented, but
The gnulib documentation mentions this feature of Bionic (Android's libc), but doesn't seem to do anything about it. I guess it needs to test whether all of these functions are declared, rather than merely whether they exist in libc? Something similar is already done for truncate (commit a0f15cb).