delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/12/23/18:25:41

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <002701c2aada$874d2e90$fe47893e@pomello>
From: "Max Bowsher" <maxb AT ukf DOT net>
To: <fabrizio_ge-wolit AT tiscali DOT it>, <cygwin AT cygwin DOT com>
References: <3E00A20100008131 AT mail-8 DOT tiscalinet DOT it>
Subject: Re: Strange behaviour of gcc
Date: Mon, 23 Dec 2002 23:25:00 -0000
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

fabrizio_ge-wolit AT tiscali DOT 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?

Yes. Gcc's optimizer chose to make a large amount of local variable
allocation into an alloca call.

Does it matter?

Max.


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019