From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8DE713857804; Thu, 15 Oct 2020 11:18:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DE713857804 From: "ktkachov at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/97442] New: Wrong represenation of AArch64 saba in RTL Date: Thu, 15 Oct 2020 11:18:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: unknown X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ktkachov 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_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone cf_gcctarget 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2020 11:18:34 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97442 Bug ID: 97442 Summary: Wrong represenation of AArch64 saba in RTL Product: gcc Version: unknown Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: ktkachov at gcc dot gnu.org Target Milestone: --- Target: aarch64 This is similar to the issue fixed in https://gcc.gnu.org/git/?p=3Dgcc.git&a=3Dcommit;h=3D8544ed6eea68a80999504c8= a4b21b77d29cd86e2 The representation of the SABA (and UABA) in RTL is not correct and the bel= ow testcase will abort at -O3 -fwrapv: #define N 16 signed char a[] =3D {-100, -100, -100, -100,-100, -100, -100, -100, -100, -= 100, -100, -100, -100, -100, -100, -100 }; signed char b[] =3D { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100= , 100, 100, 100, 100, 100 }; signed char out[N] =3D { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, = 100, 100, 100, 100, 100, 100 }; __attribute__ ((noinline,noipa)) void foo (void) { for (int i =3D 0; i < N; i++) { signed char diff =3D b[i] - a[i]; out[i] +=3D diff > 0 ? diff : -diff; } } signed char out2[N] =3D { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,= 100, 100, 100, 100, 100, 100 }; __attribute__ ((noinline,noipa)) void foo_scalar (void) { for (int i =3D 0; i < N; i++) { asm volatile (""); signed char diff =3D b[i] - a[i]; out2[i] +=3D diff > 0 ? diff : -diff; } } int main (void) { foo (); foo_scalar (); for (int i =3D 0; i < N; i++) if (out[i] !=3D out2[i]) __builtin_abort (); return 0; } due to function foo generating a saba when it shouldn't=