From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17961 invoked by alias); 2 Jun 2015 21:18:34 -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 17908 invoked by uid 89); 2 Jun 2015 21:18:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 02 Jun 2015 21:18:31 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id EAC2CA0CD8; Tue, 2 Jun 2015 21:18:29 +0000 (UTC) Received: from localhost.localdomain (ovpn-113-154.phx2.redhat.com [10.3.113.154]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t52LITsI004854; Tue, 2 Jun 2015 17:18:29 -0400 Message-ID: <556E1DA5.4070701@redhat.com> Date: Tue, 02 Jun 2015 21:22:00 -0000 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Alexander Basov , gcc-patches@gcc.gnu.org Subject: Re: Fix PR43404, PR48470, PR64744 ICE on naked functions References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00254.txt.bz2 On 06/01/2015 04:12 AM, Alexander Basov wrote: > Hi, > this patch fixes ICE when compiling naked functions for arm targets. > It prevents register allocation for non-register things like volatile, > float, BLKMode vars. > > Tested on trunk with arm-v7ar-linux-gnueabi on qemu vexpress board. > > -- Alexander > > > pr64744.patch > > > 2015-06-01 Alexander Basov > > PR middle-end/64744 > PR middle-end/48470 > PR middle-end/43404 > > * gcc/cfgexpand.c (expand_one_var): Add check if stack is going to > be used in naked function. > * gcc/expr.c (expand_expr_addr_expr_1): Remove exscess checking > whether expression should not reside in MEM. > * gcc/function.c (use_register_for_decl): Do not use registers for > non-register things (volatile, float, BLKMode) in naked functions. Lose the "gcc/" prefix on these entries as there's a ChangeLog in the gcc/ subdirectory. > > * gcc/testsuite/gcc.target/arm/pr43404.c : New testcase. > * gcc/testsuite/gcc.target/arm/pr48470.c : New testcase. > * gcc/testsuite/gcc.target/arm/pr64744-1.c : New testcase. > * gcc/testsuite/gcc.target/arm/pr64744-2.c : New testcase. Similarly, lose the gcc/testsuite prefix on these entries as this will be installed in gcc/testsuite/ChangeLog. However, do copy the PR markers. > > diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c > index b190f91..c6db8a9 100644 > --- a/gcc/cfgexpand.c > +++ b/gcc/cfgexpand.c > @@ -1382,7 +1382,15 @@ expand_one_var (tree var, bool toplevel, bool really_expand) > else > { > if (really_expand) > - expand_one_stack_var (origvar); > + { > + if (!targetm.calls.allocate_stack_slots_for_args ()) > + error ("cannot allocate stack for variable %q+D, naked function.", > + var); > + > + expand_one_stack_var (origvar); > + } So how do you know ORIGVAR is an argument here before issuing the error? ie, shouldn't you verify that the underlying object is a PARM_DECL? If there's some way we already know we're dealing with a PARM_DECL, then just say so. I'd rewrite the user_register_for_decl ChangeLog entry to * function.c (use_register_for_decl): Correct location of allocate_stack_slot_for_args test. With those changes this should be ready to go, please make the updates and repost. Thanks, jeff