From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18842 invoked by alias); 28 Jun 2004 17:36:52 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 18835 invoked from network); 28 Jun 2004 17:36:51 -0000 Received: from unknown (HELO mgr2.xmission.com) (198.60.22.202) by sourceware.org with SMTP; 28 Jun 2004 17:36:51 -0000 Received: from [198.60.22.201] (helo=mgr1.xmission.com) by mgr2.xmission.com with esmtp (Exim 3.35 #1) id 1Bf03l-0002Gk-02; Mon, 28 Jun 2004 11:36:49 -0600 Received: from [166.70.238.4] (helo=solaris.xmission.com) by mgr1.xmission.com with esmtp (Exim 4.32) id 1Bf03l-0005P9-RG; Mon, 28 Jun 2004 11:36:49 -0600 Received: from llewelly by solaris.xmission.com with local (Exim 3.16 #3) id 1Bf03l-0001aq-00; Mon, 28 Jun 2004 11:36:49 -0600 To: Purnendu/Gmail Cc: Eljay Love-Jensen , Prawit Chaivong , gcc-help@gcc.gnu.org References: <20040628152711.18563.qmail@web60507.mail.yahoo.com> <6.1.1.1.2.20040628104511.022934f0@iplan-mn.corp.adobe.com> <4ca029ac04062809323fb4624f@mail.gmail.com> From: llewelly@xmission.com Date: Mon, 28 Jun 2004 17:36:00 -0000 In-Reply-To: <4ca029ac04062809323fb4624f@mail.gmail.com> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Subject: Re: question about allocating local variable Content-Type: text/plain; charset=us-ascii X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on mgr1.xmission.com X-Spam-Level: X-Spam-Status: No, hits=0.3 required=8.0 tests=NO_REAL_NAME autolearn=no version=2.63 X-SA-Exim-Connect-IP: 166.70.238.4 X-SA-Exim-Mail-From: llewelly@xmission.com X-SA-Exim-Version: 4.0 (built Sat, 24 Apr 2004 12:31:30 +0200) X-SA-Exim-Scanned: Yes (on mgr1.xmission.com) X-SW-Source: 2004-06/txt/msg00280.txt.bz2 Purnendu/Gmail writes: > On a solaris platform with gcc 3.0 the one i have > out put for such a behaviour is pretty predictive. > > It allocates a stack of 120 for char a[1] to char a[8] > then 128 for char a[9] to char a[16] > and so on. > > for an integer array > It allocates a stack of 120 for int a[1] and int a[2] > then 128 for int a[3] to int a[4] > and so on. > > with a allignment of 4 bytes > > =============== > > .file "help.c" > .section ".text" > .align 4 > .global main > .type main,#function > .proc 04 > main: > !#PROLOGUE# 0 > save %sp, -128, %sp This isn't just for your array. Most of it is for saving the register stack. > !#PROLOGUE# 1 > ret > restore > .LLfe1: > .size main,.LLfe1-main > .ident "GCC: (GNU) 3.0" > ~ [snip]