From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35508 invoked by alias); 1 Jun 2015 11:19:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 35486 invoked by uid 89); 1 Jun 2015 11:19:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f182.google.com Received: from mail-ob0-f182.google.com (HELO mail-ob0-f182.google.com) (209.85.214.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 01 Jun 2015 11:19:00 +0000 Received: by obbea2 with SMTP id ea2so100545971obb.3 for ; Mon, 01 Jun 2015 04:18:58 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.182.80.225 with SMTP id u1mr17962524obx.23.1433157538243; Mon, 01 Jun 2015 04:18:58 -0700 (PDT) Received: by 10.76.115.167 with HTTP; Mon, 1 Jun 2015 04:18:58 -0700 (PDT) In-Reply-To: <2953955.A7ElB1Yu05@polaris> References: <2953955.A7ElB1Yu05@polaris> Date: Mon, 01 Jun 2015 11:19:00 -0000 Message-ID: Subject: Re: [patch] Fix ICE on function [not] returning variable size From: Richard Biener To: Eric Botcazou Cc: GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00045.txt.bz2 On Mon, Jun 1, 2015 at 12:43 PM, Eric Botcazou wrote: > Hi, > > this fixes an ICE on a function returning a variable-sized record type but > discovered to be no-return by the optimizer. In this case, the LHS of the > GIMPLE call statement is removed so the RTL expander attempts to allocate a > temporary and fails: > > eric@polaris:~/build/gcc/native> gcc/gnat1 -quiet varsize_return2.ads -O > +===========================GNAT BUG DETECTED==============================+ > | 6.0.0 20150531 (experimental) [trunk revision 223897] (x86_64-suse-linux) > GCC error:| > | in assign_stack_temp_for_type, at function.c:793 > > because it too cannot create temporaries of variable size. > > The attached patch simply preserves the LHS throughout the GIMPLE pipeline. > It also simplifies the relevant test in gimplify_modify_expr_rhs, which was > overly broad. > > Tested on x86_64-suse-linux, OK for the mainline? Ok. (I wonder if there are any cases where the return value is allocated by the callee?) Thanks, Richard. > > 2015-06-01 Eric Botcazou > > * gimplify.c (gimplify_modify_expr_rhs): Use simple test on the size. > * cgraph.c (cgraph_redirect_edge_call_stmt_to_callee): Do not remove > the LHS of a no-return call if its type has variable size. > * tree-cfgcleanup.c (fixup_noreturn_call): Likewise. > * tree-cfg.c (verify_gimple_call): Accept these no-return calls. > > > 2015-06-01 Eric Botcazou > > * gnat.dg/specs/varsize_return2.ads: New test. > * gnat.dg/specs/varsize_return2_pkg.ad[sb]: New helper. > > > -- > Eric Botcazou