https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78717
Bug ID: 78717 Summary: no definition of string::find when lowered to gimple Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: hiraditya at msn dot com Target Milestone: --- $ cat test.cpp #include<string> int foo(const std::string &s1, const std::string &s2, int i) { return s1.find(s2) == i; } ../gcc/install/usr/bin/g++ -S -o a.s ../a.cpp -fdump-tree-all-all $ cat a.cpp.004t.gimple int foo(const string&, const string&, int) (const struct string & s1, const struct string & s2, int i) { intD.9 D.27718; # USE = anything # CLB = anything _1 = _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4findERKS4_mD.18492 (s1D.24055, s2D.24056, 0); _2 = (long unsigned intD.14) iD.24057; _3 = _1 == _2; D.27718 = (intD.9) _3; return D.27718; } The problem is that now inliner cannot see the definition of std::string::find and hence cannot inline it. Maybe because std::basic_string<char> is an extern template, but I would hope that at least the definition should be visible to the optimizer. That would help improve the performance of programs using string::find. Thanks,