https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67713
Bug ID: 67713 Summary: builtin cmpstrn not used if not one of the inputs is not a string literal Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: olegendo at gcc dot gnu.org Target Milestone: --- It seems that the following int test_06 (const char* s1) { return __builtin_strncmp (s1, "abcdabcd", 8); } will emit the builtin strncmp code, while int test_07 (const char* s1, const char* s2) { return __builtin_strncmp (s1, s2, 8); } will always invoke the strncmp function. This happens on trunk for SH and on GCC 4.9 (Ubuntu 4.9.2-10ubuntu13) for x86_64. Not sure whether this is a tree or RTL issue, though.