From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8F3BE3858D32; Mon, 24 Jul 2023 11:28:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F3BE3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690198101; bh=clJiLckegFsaDfb+8j1UPYvsurfiaRyYPsSB5j79QXo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MZLsuExwHvJep+fN0Ru8ppEx16o3DX/CbXBEMv9KDJmfsG2Z804JR3oLBPoVqAJ6T GAJbdTZWpNzsgA3ILeyKJ4+MvZACbeJ20xUQa/YshTnzaMWpyKF3Y72KfgBAScKCSr QhA4gvZM4kNmpZXufgYdDw3Um33XU/Z73yPd7zZI= From: "acoplan at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/110791] [12/13/14 Regression] arm: Wrong code with -Os -march=armv8.1-m.main Date: Mon, 24 Jul 2023 11:27:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: acoplan at gcc dot gnu.org X-Bugzilla-Status: WAITING 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: Message-ID: In-Reply-To: References: 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=3D110791 --- Comment #2 from Alex Coplan --- (In reply to Xi Ruoyao from comment #1) > Isn't this a UB? >=20 > while (p >=3D path && *p !=3D '/') > p--; >=20 > This will cause p to become "&main::path[0] - 1". C23 6.5.6p9: In this case, with the input given in main, I think p should end up pointin= g to main::path + 1 (since we pass in main::path + 2, and foo can only ever decrement p at most one below its parameter path).=