This is the mail archive of the
mailing list for the GCC project.
Re: Can realloc be marked as a mallloc-like function?
- From: "H.J. Lu" <hjl at lucon dot org>
- To: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Cc: gcc at gcc dot gnu dot org, fortran at gcc dot gnu dot org, jb at gcc dot gnu dot org, GNU C Library <libc-alpha at sources dot redhat dot com>
- Date: Sat, 14 Jul 2007 09:20:19 -0700
- Subject: Re: Can realloc be marked as a mallloc-like function?
- References: <20070714160016.GA7949@lucon.org> <4698F3D5.firstname.lastname@example.org>
On Sat, Jul 14, 2007 at 06:03:33PM +0200, Tobias Schlüter wrote:
> H.J. Lu wrote:
> >It looks like gcc assumes a functon marked with DECL_IS_MALLOC won't
> >return an address which can alias something else. But it isn't true
> >for realloc. Now, the qestions are
> >1. Can gcc make such an assumption?
> >2. Can realloc be marked as DECL_IS_MALLOC.
> >BTW, glibc also marks realloc with __attribute_malloc__.
> There was an absurdely long thread on this topic starting at
> <http://gcc.gnu.org/ml/gcc/2004-01/msg00005.html>. I didn't dig through
> it to find the answer.
Now, we have a real testcase to show the problem. How do we solve