From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6C70B3857C62; Mon, 4 Dec 2023 09:27:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C70B3857C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701682061; bh=lBgaaosCo+3pIOj28dvkPsU5luVmxNpvP2lvUAZjBUk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gFVS+MOVIG/RbbhrPG2DTKb+cxBH5AyVDqdrEmoieKoYTivbNR4xzhO9/PwkeQNx0 2DMvKREKhIWrlGcCNzuIAQ2tsYXeq3WAOFteU3sB57WnbTVpcYPSsBs3GY5xMQmB5o 49gwyc2pamHnUcih61ohLrt1YYtFhfI7q1+Gr+CQ= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/112830] internal compiler error: in convert_memory_address_addr_space_1, at explow.cc:302 Date: Mon, 04 Dec 2023 09:27:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: addr-space, ice-on-valid-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: --- 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=3D112830 --- Comment #7 from Richard Biener --- The following avoids gimplifying to a memcpy, but we are not prepared for WITH_SIZE_EXPR in GIMPLE assigns (guess we think we can handle all with memcpy). Removing the verification makes the testcase "work" as well. diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index 02f85e7109b..a1d5ee28cbe 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -6331,7 +6331,8 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gim ple_seq *post_p, && TYPE_SIZE_UNIT (TREE_TYPE (*from_p)) && !poly_int_tree_p (TYPE_SIZE_UNIT (TREE_TYPE (*from_p))) && TREE_CODE (*from_p) =3D=3D CONSTRUCTOR - && CONSTRUCTOR_NELTS (*from_p) =3D=3D 0) + && CONSTRUCTOR_NELTS (*from_p) =3D=3D 0 + && ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (TREE_TYPE (*to_p)))) { maybe_with_size_expr (from_p); gcc_assert (TREE_CODE (*from_p) =3D=3D WITH_SIZE_EXPR); @@ -6464,10 +6465,12 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre= _p, gimple_seq *post_p, tree from =3D TREE_OPERAND (*from_p, 0); tree size =3D TREE_OPERAND (*from_p, 1); - if (TREE_CODE (from) =3D=3D CONSTRUCTOR) + if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (TREE_TYPE (*to_p))) + || !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (TREE_TYPE (from)))) + ; + else if (TREE_CODE (from) =3D=3D CONSTRUCTOR) return gimplify_modify_expr_to_memset (expr_p, size, want_value, pre_p); - - if (is_gimple_addressable (from)) + else if (is_gimple_addressable (from)) { *from_p =3D from; return gimplify_modify_expr_to_memcpy (expr_p, size, want_value,=