[Bug middle-end/78809] Inline strcmp with small constant strings

qing.zhao at oracle dot com gcc-bugzilla@gcc.gnu.org
Tue Oct 24 15:26:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78809

--- Comment #11 from Qing Zhao <qing.zhao at oracle dot com> ---
(In reply to Wilco from comment #9)

> str(n)cmp with a constant string can be changed into memcmp if the string has a
> known alignment or is an array of known size. We should check the common cases
> are implemented.

Please provide an example in which a str(n)cmp with a constant string can be
changed into
memcmp. 

(From my understanding, for the strcmp (p, “fish”),  since we don’t know what
will be in the string
pointed by “p”, and there might be NULL_terminator in any of the place of p, we
have to compare
each char in “p” one by one, do I miss anything here?)


More information about the Gcc-bugs mailing list