This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: free (static_array)
- From: Sajish V <emailsaju at yahoo dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>, Michael Meissner <gnu at the-meissners dot org>
- Cc: Denys Vlasenko <vda dot linux at googlemail dot com>, gcc at gcc dot gnu dot org
- Date: Tue, 8 Jul 2008 02:48:42 -0700 (PDT)
- Subject: Re: free (static_array)
Thanks everyone!
I will file a feature request for this via bugzilla.
Regards,
Sajish.
----- Original Message ----
From: Joseph S. Myers <joseph@codesourcery.com>
To: Michael Meissner <gnu@the-meissners.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>; Sajish V <emailsaju@yahoo.com>; gcc@gcc.gnu.org
Sent: Tuesday, July 1, 2008 5:07:05 PM
Subject: Re: free (static_array)
On Tue, 1 Jul 2008, Michael Meissner wrote:
> 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?
An error is inappropriate; undefined behavior only occurs on execution of
the call to free, not on compilation of the program. A warning would be
fine (as would converting the call to free into an abort).
--
Joseph S. Myers
joseph@codesourcery.com