This is the mail archive of the gcc@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]

Re: free (static_array)


On Tue, Jul 01, 2008 at 11:50:58AM +0200, Denys Vlasenko wrote:
> On Tuesday 01 July 2008 09:24, Sajish V wrote:
> > Thanks for the reply, Denys.
> > My question was, why doesn't gcc catch it during compilation? It is clear
> > that we are trying to free a variable from stack. Shouldn't gcc flag an
> > error for this during compilation?

It could.  Nobody has written the code to do so, and as they say patches are
welcome (assuming you have done the paperwork to legally contribute to GCC).
Have you filed a feature request via bugzilla so that it can be tracked?

> How gcc can know that free() is not supposed to be used like that?

Unless you use the -ffreestanding or -fno-builtin switches, the compiler is
free to know about any function mentioned in the ISO C standard (or C++,
etc. depending on your language).

-- 
Michael Meissner
email: gnu@the-meissners.org
http://www.the-meissners.org


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