From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2275D385842A; Tue, 1 Nov 2022 19:34:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2275D385842A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667331254; bh=KAP0qS9IRbNcTB77DlAAO93eyMwy6NIUSFQO65q/fXY=; h=From:To:Subject:Date:From; b=PDVmC44FplGS4YHW5gM76mEEkjQ4yMQwt0JFfbIvZ8ru5XcbzRAjzplWKwRHLmg7d P+LIcDV/jw/yBJvAu3dCfdhQia+Qlr3esZr42woHV5KfLm8h1lx8J977GIcd299zTU 0AbYmA3k3v9Xg/4W2o0Ca3eqP746DUp/52XJ4hS0= From: "unlvsur at live dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107502] New: GCC fails to detect foo(first_const,last)-first_const+first pattern Date: Tue, 01 Nov 2022 19:34:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: unlvsur at live dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107502 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=