From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 566813858C60; Thu, 8 Feb 2024 14:40:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 566813858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707403209; bh=230M5DXKy+FXplcA5SzpUMh1zi9AKlLd9QdegdQBcNo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=D/w9KOQj9geKuOJlaBR/gkXRsaaR9lRIF0licqlRr/Jp/YXswrgolpvp3+s5Z1XUt DIZrJoZrfJ6GHPe01+2JcbFGA+6L23vIu/kmlhnkE7u0bcEK4GRlQfFRp27wELT1KU DOFwn+nE4xcpCfJFiEX+78yUeRbAersqS2LcMrtY= From: "acoplan at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113787] [12/13/14 Regression] Wrong code at -O with ipa-modref on aarch64 Date: Thu, 08 Feb 2024 14:40:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: acoplan at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.4 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=3D113787 --- Comment #12 from Alex Coplan --- Here is an alternative testcase that also fails in the same way on the GCC = 12 and 13 branches: void foo(int x, int y, int z, int d, int *buf) { for(int i =3D z; i < y-z; ++i) for(int j =3D 0; j < d; ++j) buf[i*x+(z-j-1)] =3D buf[i*x+(z+j)]; } void bar(int x, int y, int z, int d, int *buf) { for(int i =3D 0; i < d; ++i) for(int j =3D z; j < x-z; ++j) buf[j+(z-i-1)*x] =3D buf[j+(z+i)*x]; } __attribute__((noipa)) void baz(int x, int y, int d, int *buf) { foo(x, y, 0, d, buf); bar(x, y, 0, d, buf); } int main(void) { int a[] =3D { 1, 2, 3 }; baz (1, 2, 1, a+1); /* buf =3D a+1. foo does: buf[-1] =3D buf[0]; // { 2, 2, 3 } buf[0] =3D buf[1]; // { 2, 3, 3 } bar does: buf[-1] =3D buf[0]; // { 3, 3, 3 } */ for (int i =3D 0; i < 2; i++) if (a[i] !=3D 3) __builtin_abort (); }=