Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <20021224051134.95173.qmail@web21408.mail.yahoo.com>
Date: Tue, 24 Dec 2002 16:11:34 +1100 (EST)
From: =?iso-8859-1?q?Danny=20Smith?= <danny_r_smith_2001@yahoo.co.nz>
Subject: Re:Strange behaviour of gcc
To: cygwin@cygwin.com
Cc: fabrizio_ge-wolit@tiscali.it
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

fabrizio_ge-wolit@tiscali.it wrote:
> Can somebody explain why gcc (version 3.2 20020927) on Cygwin does
> this? Type this simple C program
>
> void func(void){
>   struct {unsigned char data[3985];}var;
> }
>
> and compile with
>
> gcc -c filename.c
>
> Then type
>
> nm filename.o
>
> The output is
>
> 00000000 b .bss
> 00000000 d .data
> 00000000 t .text
>          U __alloca
> 00000000 T _func
>
> Why on earth is the symbol __alloca doing there?
>
> Just change the program to
>
> void func(void){
>   struct {unsigned char data[3984];}var;
> }
>
> and compile it. This time, nm's output is
>
> 00000000 b .bss
> 00000000 d .data
> 00000000 t .text
> 00000000 T _func
>
> as it should. Is there a reason why the symbol __alloca appears?


GCC's __builtin_alloca uses a helper function called _alloca to check the stack
whenever allocating more that 4000  bytes in one go.

Danny

http://movies.yahoo.com.au - Yahoo! Movies
- What's on at your local cinema?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

