From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2EB6B3858C5E; Thu, 19 Oct 2023 11:06:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2EB6B3858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697713570; bh=yCIptPI0uw74NVhrzSYgnriUrmzBjbeaP504G3UQ4Uo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qkByZA59N/QOD1NZL76X8qRb6ZlqdG0VVGNZhkmQ/+TJde/srQSJi5M9Uo86gnn1V lxsVMeNVlZ68O0wbS2Wd20nW1CGxSMhX2PWUaz+w8P1t90tDgKx7PfdRggHN6CbO+S EakzyNaAOpwto0UiLRghPMjrZFr88SQv4URY9n+U= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111591] ppc64be: miscompilation with -mstrict-align / -O3 Date: Thu, 19 Oct 2023 11:06:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: needs-bisection 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: linkw 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=3D111591 --- Comment #22 from Richard Biener --- I see the mems properly get their base adjusted: (insn 384 383 0 (set (mem/c:V2DI (plus:DI (reg/f:DI 112 virtual-stack-vars) (const_int 16 [0x10])) [7 MEM[(struct Vec128D.30433 *)_10]+0 S16 A128]) (reg:V2DI 616)) -1 (nil)) vs. (insn 389 388 390 (set (reg:HI 619) (mem/c:HI (plus:DI (reg/f:DI 112 virtual-stack-vars) (const_int 16 [0x10])) [4 MEM[(struct Vec128D.30212 *)_10].rawD.30221[0]+0 S2 A128])) "test.cc":218:14 -1 (nil)) both are based off a fake _10. But we get alias sets 7 and 4 used here which might be a problem. See update_alias_info_with_stack_vars and uses of decls_to_pointers, in particular from set_mem_attributes_minus_bitpos where we preserve TBAA info with the rewrite. I'm not sure why that should be OK ... (but I'm sure I must have thought of this problem back in time) Does the following fix the testcase? diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc index 84b6833225e..81c0a63eddc 100644 --- a/gcc/emit-rtl.cc +++ b/gcc/emit-rtl.cc @@ -2128,7 +2128,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, tree *orig_base =3D &attrs.expr; while (handled_component_p (*orig_base)) orig_base =3D &TREE_OPERAND (*orig_base, 0); - tree aptrt =3D reference_alias_ptr_type (*orig_base); + tree aptrt =3D ptr_type_node; *orig_base =3D build2 (MEM_REF, TREE_TYPE (*orig_base), *name= p, build_int_cst (aptrt, 0)); }=