This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/41001] alloca broken for -fno-builtin
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Aug 2009 22:36:28 -0000
- Subject: [Bug middle-end/41001] alloca broken for -fno-builtin
- References: <bug-41001-15155@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from joseph at codesourcery dot com 2009-08-07 22:36 -------
Subject: Re: alloca broken for -fno-builtin
On Fri, 7 Aug 2009, ktietz at gcc dot gnu dot org wrote:
> Well, if so. It makes no sense that -fno-builtins tries to call a function
> which isn't present. But for other compilers, alloca can be invoked as
> function, too. The compiler builtin part in all cases is, to be aware that
> stack frame changes (hot-region, call save-area, and co are adjusted after
> calling it).
-fno-builtin means more or less exactly that the compiler *should not*
assume anything special about a function from its name (unless the name
starts __builtin or some similar reserved-namespace cases such as __sync)
- that is, you declare alloca and because of -fno-builtin the compiler
assumes this is your own function with no special semantics whatever. By
-fno-builtin you are declaring that alloca, and all other normally
built-in functions, are normal functions with no special semantics the
compiler needs to know about. So of course it generates a call like it
would to any other random function you might have defined in another
translation unit.
If you want to use alloca with its traditional memory allocation semantics
with -fno-builtin, you'll need to use a malloc-based emulation such as
that in libiberty, not something that uses the stack.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41001