This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: malloc attributes and realloc
> From: Robert Dewar <dewar@gnat.com>
>
> Kaveh R. Ghazi wrote:
>
> > Note many (most?) allocation in GCC occurs in other functions besides
> > the few libiberty functions with the attribute. So I think the
> > optimization is pretty good to get as much as it does.
>
> Pretty amazing I would say. If those figures are correct, then it is
> indeed surprising that this helps so much, and perhaps means that this
> thread is not 100% idle chatter :-)
I would encourage someone to verify my results. I bootstrapped
mainline with --disable-checking --enable-languages=c --disable-nls
--enable-multilib=no on sparc-sun-solaris2.7 both with and without the
patch below. Then I compiled combine.i with -S -g -O2 five times with
each compiler to get my figures. I'd be interested to hear results
from other platforms.
--Kaveh
diff -rup orig/egcc-CVS20040102/include/ansidecl.h egcc-CVS20040102/include/ansidecl.h
--- orig/egcc-CVS20040102/include/ansidecl.h Tue Jun 17 10:05:22 2003
+++ egcc-CVS20040102/include/ansidecl.h Fri Jan 2 23:13:12 2004
@@ -244,7 +244,7 @@ So instead we use the macro below and te
/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
#ifndef ATTRIBUTE_MALLOC
-# if (GCC_VERSION >= 2096)
+# if 0
# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
# else
# define ATTRIBUTE_MALLOC