From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A3E1E3858D32; Mon, 24 Jul 2023 11:29:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A3E1E3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690198187; bh=6hL5Fspom+OTEj3Mhgg2ZDL6J47foTWUtCIjpX58GEY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UrTp826ro4ZW2m0TveYuL2eAYrlkxO7WJd0RR0THVIaYTPoo/Ey64sltv49cSvPZQ +dIljg2/c3oCdSMFO2Z5MuS61Fj/+QHWkQgF5fG4ymb4xXqn+2fx9G/f4vTNVzdsjn qN7CN0Mqx/oO5oTbkZCe2kr7mI+zZnMb3OmV+6HE= From: "xry111 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:29:47 +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: xry111 at gcc dot gnu.org 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_status everconfirmed 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 Xi Ruoyao changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |UNCONFIRMED Ever confirmed|1 |0 --- Comment #3 from Xi Ruoyao --- (In reply to Alex Coplan from comment #2) > (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: >=20 > In this case, with the input given in main, I think p should end up point= ing > 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). Sorry, I misread the code. I guess I need to drink some coffee now...=