gmp-impl.h contains:
#if ! HAVE_MEMSET
#define memset(p, c, n) \
do { \
ASSERT (n >= 0); \
int __i; \
for (__i = 0; __i < (n); __i++) \
(p)[__i] = (c); \
} while (0)
#endif
This may bite. I would suggest adding a cast of (p) to unsigned char *.
Regards,
E.