http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55309
--- Comment #55 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2013-02-22 16:10:49 UTC --- I believe the arguments to memcmp must point to objects with at least the given number of bytes. (For strcmp, they must point to NUL-terminated strings. For strncmp, they must point to objects that either have at least the given number of bytes or have bytes present up to a NUL within that number of bytes - there's no guarantee that comparison stops early when characters differ except for not reading after a NUL. By comparison, the array passed to memchr may be shorter than the given length if a matching character is found early - see the wording added in C11 for memchr for alignment with POSIX. But memcmp has no such special rule.)