From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2AFEB3857820; Tue, 25 May 2021 08:20:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2AFEB3857820 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100727] [12 Regression] Recent change to WITH_SIZE_EXPR handling breaks mn10300-elf Date: Tue, 25 May 2021 08:20:19 +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: 12.0 X-Bugzilla-Keywords: 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: 12.0 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 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: Tue, 25 May 2021 08:20:20 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100727 --- Comment #3 from Richard Biener --- So it's fixed with diff --git a/gcc/calls.c b/gcc/calls.c index f3da1839dc5..74a5070605e 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2397,6 +2397,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, already in memory, instead of making a copy. Likewise if we w= ant to make the copy in the callee instead of the caller. */ if ((call_from_thunk_p || callee_copies) + && TREE_CODE (args[i].tree_value) !=3D WITH_SIZE_EXPR && (base =3D get_base_address (args[i].tree_value)) && TREE_CODE (base) !=3D SSA_NAME && (!DECL_P (base) || MEM_P (DECL_RTL (base)))) where the get_base_address change lets WITH_SIZE_EXPR through now but not before. The only obvious followon difference is that we then do mark_addressable (args[i].tree_value); ... args[i].tree_value =3D build_fold_addr_expr_loc (loc, args[i].tree_value= ); type =3D TREE_TYPE (args[i].tree_value); unchanged is that we pass the argument by reference and that the target requests callee_copies. Now, this is variadic args, so maybe the callee_copies thing doesn't apply and/or the varargs setup code now is inconsistent - in the end it's an ABI change. So given get_base_address only ever returned NULL for WITH_SIZE_EXPR and clearly the !base check switches between ABIs we have to make the WITH_SIZE_EXPR check explicit. I'm also testing the additional (but then not needed) diff --git a/gcc/gimple-expr.c b/gcc/gimple-expr.c index b8c732b632a..c3211795d33 100644 --- a/gcc/gimple-expr.c +++ b/gcc/gimple-expr.c @@ -900,6 +900,8 @@ flush_mark_addressable_queue () void mark_addressable (tree x) { + if (TREE_CODE (x) =3D=3D WITH_SIZE_EXPR) + x =3D TREE_OPERAND (x, 0); while (handled_component_p (x)) x =3D TREE_OPERAND (x, 0); if (TREE_CODE (x) =3D=3D MEM_REF=