From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8567 invoked by alias); 15 Mar 2011 06:41:23 -0000 Received: (qmail 8556 invoked by uid 22791); 15 Mar 2011 06:41:22 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Mar 2011 06:41:15 +0000 Received: by wyb40 with SMTP id 40so232449wyb.20 for ; Mon, 14 Mar 2011 23:41:13 -0700 (PDT) Received: by 10.227.20.74 with SMTP id e10mr6158032wbb.125.1300171272995; Mon, 14 Mar 2011 23:41:12 -0700 (PDT) Received: from [192.168.1.107] (66.37.187.81.in-addr.arpa [81.187.37.66]) by mx.google.com with ESMTPS id w25sm703973wbd.23.2011.03.14.23.41.12 (version=SSLv3 cipher=OTHER); Mon, 14 Mar 2011 23:41:12 -0700 (PDT) Message-ID: <4D7F0A04.90402@linaro.org> Date: Tue, 15 Mar 2011 06:41:00 -0000 From: Ramana Radhakrishnan User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 To: Chung-Lin Tang CC: gcc-patches , Richard Earnshaw Subject: Re: [PATCH, ARM] Fix PR 43872, incorrectly aligned VLAs References: <4D5CF204.4080306@codesourcery.com> In-Reply-To: <4D5CF204.4080306@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2011-03/txt/msg00800.txt.bz2 On 17/02/11 10:01, Chung-Lin Tang wrote: > Hi, > this PR is a case where we have a leaf function with a zero-size frame, > that calls alloca() (here through a C99 VLA). > > The ARM backend recognizes the leaf-and-no-frame opportunity to save an > unneeded stack alignment. But when calling alloca(), the allocated block > is of BIGGEST_ALIGNMENT, which is 8-bytes under current AAPCS. Thus a > stack align may still be needed to place the alloca() returned block > properly. > > This patch adjusts the early return condition with !cfun->calls_alloca. > Tested without regressions on ARM-Linux, okay for trunk? OK. > > Also related, the BIGGEST_ALIGNMENT defined for ARM is currently > ABI-based; 64-bits for AAPCS targets, and 32 for old ABI. Should this > also consider arch-level as well? i.e. anything>= ARMv5TE (with ldrd) > should have this set to 64. I don't think it's that straightforward. The ABI specifies that an 8 byte quantity must be aligned at 64 bit boundaries and this should be independent of architecture revisions. Think about pointers to 64 bit quantities passed from !(TARGET_LDRD) to TARGET_LDRD code or indeed creating structure layout issues between architecture revisions if you change this. cheers Ramana > 2011-02-17 Chung-Lin Tang > > PR target/43872 > * config/arm/arm.c (arm_get_frame_offsets): Adjust early > return condition with !cfun->calls_alloca.