gvariant tests: workaround libc/compiler "issue"
memcmp() is declared by glibc as follows: /* Compare N bytes of S1 and S2. */ extern int memcmp (const void *__s1, const void *__s2, size_t __n) __THROW __attribute_pure__ __nonnull ((1, 2)); despite the fact that it is valid to call it with a null pointer if the size is zero. gcc 4.9.0 contains a new optimisation that sees that we pass a pointer to this function and concludes that it certainly must not be null, removing a later check and thereby causing a crash. We protect the invocation of memcmp() with a condition to prevent gcc from making this false assumption (arguably under wrong advice from glibc).
parent
cf9b162e
Please register or sign in to comment