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