This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/41001] alloca broken for -fno-builtin



------- Comment #3 from ktietz at gcc dot gnu dot org  2009-08-07 21:05 -------
(In reply to comment #2)
> Subject: Re:   New: alloca broken for -fno-builtin
> 
> On Fri, 7 Aug 2009, ktietz at gcc dot gnu dot org wrote:
> 
> > The function alloca (for cygwin/mingw target _alloca) is broken or not
> > available (for linux64), when using option -fno-builtin.
> 
> It is in the nature of alloca that it needs to be built in to the compiler 
> for an effective implementation, and the lack of a library emulation 
> (using malloc) is nothing to do with the compiler.  Why do you think there 
> is a bug here?
> 
> > The linux and win32 targets the symbol alloca isn't present. For windows
> > targets there is an implementation (_alloca) in gcc/config/i386/cygwin.asm
> > present. But when using this, the stack layout is broken after calling alloca.
> 
> I do not believe _alloca is meant to be an implementation of the C alloca 
> function; if it was, it would be alloca not _alloca.  Do you have any 
> reason to believe _alloca does not follow its specification of making 
> stack space available when called implicitly by the compiler (*not* an 
> explicit C function call - it has its own special ABI so you can't call it 
> explicitly from C)?
> 

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).
IIRC it is even mentioned as function in K&R, but well I could mix-up here
something.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41001


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]