alloca() called when i do not want it to be called
Zack Weinberg
zack@codesourcery.com
Wed Sep 3 20:05:00 GMT 2003
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
More information about the Gcc
mailing list