From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1DA973833034; Wed, 2 Jun 2021 12:42:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1DA973833034 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/99122] [10 Regression] ICE in force_constant_size, at gimplify.c:733 Date: Wed, 02 Jun 2021 12:42:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 11.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: P2 X-Bugzilla-Assigned-To: jamborm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.4 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: Wed, 02 Jun 2021 12:42:42 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99122 --- Comment #34 from Richard Biener --- interestingly I see a.9_70 =3D .builtin_alloca_with_align (iftmp.8_1, 8); (*a.9_70) =3D inline22.get_zero (); [static-chain: &FRAME.20] [return slot optimization] so there's no WITH_SIZE_EXPR, but the return value ends up done by referenc= e: leaq -80(%rbp), %rdx movq %rdx, %r10 movq %rax, %rdi call inline22__get_zero.0 movq %rbx, %rsp movq -8(%rbp), %rbx leave so I wonder if omitting DECL_BY_REFERENCE is simply a bug? I mean the ABI of the callee must be aware and it seems CALL_EXPR_RETURN_SLOT_OPT is set by gimplification. IIRC CALL_EXPR_RETURN_SLOT_OPT also only means we _may_ return by reference not that we must. /* In a CALL_EXPR, means that it's safe to use the target of the call expansion as the return slot for a call that returns in memory. */ #define CALL_EXPR_RETURN_SLOT_OPT(NODE) \ (CALL_EXPR_CHECK (NODE)->base.private_flag) But of course if we do not exercise the return slot opt then there definite= ly is a WITH_SIZE_EXPR missing. Unless I'm missing somehting ... The gimplifier code checks else if (TREE_CODE (*to_p) !=3D SSA_NAME && (!is_gimple_variable (*to_p) || needs_to_live_in_memory (*to_p))) /* Don't use the original target if it's already addressabl= e; if its address escapes, and the called function uses the NRV optimization, a conforming program could see *to_p change before the called function returns; see c++/19317. When optimizing, the return_slot pass marks more functio= ns as safe after we have escape info. */ use_target =3D false; so I wonder if you can modify the Ada testcase so that CALL_EXPR_RETURN_SLOT_OPT is not set?=