From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ADF5A3851C12; Wed, 3 Jun 2020 10:00:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ADF5A3851C12 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591178422; bh=S81gp1Fx50K47+SZMHdR3QeDdXfro5/0D/hYKqTuzR4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XB5/Mh+Zgc/fWHGOxhsHBZIachudeJEvLzfqtSYQRwpwcr0E/j0prfkPVdKYs7ZNY HySwCtDhumzG8PLd2yJ74B0hA7lueZQ/eMT5UPBywHkLjDhqYNaZv+VmsjXhbj3ZIS IV8laEM55orvEe5/y6JvxjVdfY8XZSd1X7cDD0Vc= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/95493] [10/11 Regression] test for vector members apparently reordered with assignment to vector members since r10-7523-gb90061c6ec090c6b Date: Wed, 03 Jun 2020 10:00:22 +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: 10.1.0 X-Bugzilla-Keywords: alias, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to 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 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: Wed, 03 Jun 2020 10:00:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95493 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org --- Comment #4 from Richard Biener --- OK, so the issue is we're getting these MEM_ATTRs when expanding the base as (mem/c:V4SI (plus:DI (reg/f:DI 77 virtual-stack-vars) (const_int -32 [0xffffffffffffffe0])) [5 MEM[(struct ._anon_0 *)_42= ]+0 S16 A128]) and set_mem_attributes_minus_bitpos due to the variable array-ref wouldn't assign any here but inherits the already set ones. /* Default values from pre-existing memory attributes if present. */ refattrs =3D MEM_ATTRS (ref); if (refattrs) { /* ??? Can this ever happen? Calling this routine on a MEM that already carries memory attributes should probably be invalid. */ attrs.expr =3D refattrs->expr; attrs.offset_known_p =3D refattrs->offset_known_p; attrs.offset =3D refattrs->offset; attrs.size_known_p =3D refattrs->size_known_p; attrs.size =3D refattrs->size; attrs.align =3D refattrs->align; } so the following fixes the issue, the MEM_ATTRs are not what the code expects them to be set with otherwise. Because clearly offset_known_p should be false. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 2b790636366..0a72269e2ce 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -2114,6 +2114,10 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, } while (TREE_CODE (t2) =3D=3D ARRAY_REF); + attrs.expr =3D NULL_TREE; + attrs.offset_known_p =3D false; + attrs.offset =3D 0; + apply_bitpos =3D 0; if (DECL_P (t2) || (TREE_CODE (t2) =3D=3D COMPONENT_REF /* For trailing arrays t2 doesn't have a size that=