https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107502
Bug ID: 107502 Summary: GCC fails to detect foo(first_const,last)-first_const+first pattern Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: unlvsur at live dot com Target Milestone: --- GCC fails to detect foo(first_const,last)-first_const+first pattern. This is to use C++ std::contiguous_iterator interfaces with char const* foo(char const* first, char const* last) noexcept; like APIs. However, GCC fails to detect they are the same in IR and make them tail calls. See godbolt: https://godbolt.org/z/67PvYPar8