This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


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

Re: alloca is bad?


On Mon, Nov 13, 2000 at 04:29:41PM -0500, Nick Duffek wrote:
> On 13-Nov-2000, Michael Meissner wrote:
> 
> >That won't work, since alloca is a builtin provided by GCC.
> 
> That can be disabled by compiling with -fno-builtin.

It isn't as simple as that with GNU software, which generally has code like the
following in an include file:

	#if defined(__GNUC__) && !defined(C_ALLOCA)
	# ifndef alloca
	#  define alloca __builtin_alloca
	# endif
	#else /* ! defined (__GNUC__) */

(ie, if the compiler is GCC always use the builtin function).  You probably
also need to rebuild the whole app, and not just relink it.

> >If GCC is detected as the compiler at configuration time, then alloca is
> >not even built into libiberty.
> 
> True, but that's easy to circumvent.
> 
> Using -lefence or other debugging mallocs to debug alloca overruns isn't
> as easy as a simple relink, but it doesn't seem fundamentally difficult.
> 
> Nick

-- 
Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482

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