This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix malloc attribute mishandling
On Wed, 10 Feb 2010, Michael Matz wrote:
> Hi,
>
> On Tue, 9 Feb 2010, Xinliang David Li wrote:
>
> > >>> It does have clear semantics. ÂThe semantics is that a function with
> > >>> the malloc attribute returns a pointer to memory that is not aliased
> > >>> by any other pointer. ÂNo further restrictions are documented.
> > >>
> > >> Is it carved in stone or can further be refined?
> > >
> > > It's carved in stone - we can't probably break existing uses. ÂThus
> > > for a more restrictive interpretation we have to invent a new
> > > attribute (or amend the function annotation patch).
> >
> > Ok. May be a new strict_malloc attribute :)
>
> malloc_like_malloc :-)
__attribute__((fnspec("M")))
in addition to "m", which is the simple noalias case.
Richard.