https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78809
--- Comment #43 from Wilco <wilco at gcc dot gnu.org> --- (In reply to qinzhao from comment #42) > just checked in the patch for fixing the unsigned char issue as: > https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=262907 That looks it is using unsigned char accesses indeed. One more thing: the expansion happens both with -Os and -O0, and that shouldn't happen. The memcmp expansion works from -O2 onwards, which is probably a good choice for the strcmp too (a single char could be optimized with -Os but that would be the empty string).