This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: alloca() called when i do not want it to be called
- From: "Zack Weinberg" <zack at codesourcery dot com>
- To: Mike Stump <mrs at apple dot com>
- Cc: "Manik, Raina (IE10)" <Manik dot Raina at honeywell dot com>, gcc at gcc dot gnu dot org
- Date: Wed, 03 Sep 2003 12:14:23 -0700
- Subject: Re: alloca() called when i do not want it to be called
- References: <A28A43C4-DE3A-11D7-ADCE-003065A77310@apple.com>
Mike Stump <mrs@apple.com> writes:
>> 3. Is it true that if one declares a large array on stack,
>> gcc attempts to satisfy that memory requirement from the
>> .data section instead of the stack ?
>
> I don't think gcc normally does this.
This should never be done, as it produces nonreentrant code. But a
feature where very large alloca() or VLAs produced code to call
malloc, and then free on scope exit, that would be interesting.
(It is somewhat nontrivial as I believe it is legitimate to call
alloca in a loop, and expect all the memory to get freed on function
exit. VLAs do not have this problem.)
zw