aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2004-01-04 20:37:52 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2004-01-04 20:37:52 +0000
commit928a5ba9911db75442f9dfad5ca477db38f0f7fe (patch)
treec4c2ee32847e3acf20cccb296d1a784733100b89 /gcc
parent17fa55600ab8af21b974528053b4f593ae91f62d (diff)
downloadgcc-928a5ba9911db75442f9dfad5ca477db38f0f7fe.zip
gcc-928a5ba9911db75442f9dfad5ca477db38f0f7fe.tar.gz
gcc-928a5ba9911db75442f9dfad5ca477db38f0f7fe.tar.bz2
re PR c/3414 (Inaccurate documentation of __attribute__((malloc)))
PR c/3414 * doc/extend.texi: Clarify definition of malloc attribute. From-SVN: r75395
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/doc/extend.texi11
2 files changed, 13 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a1b09c0..f37704c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-04 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ PR c/3414
+ * doc/extend.texi: Clarify definition of malloc attribute.
+
2004-01-04 Jan Hubicka <jh@suse.cz>
* Makefile.in (cgraph.o, cgraphunit.o): Add intl.h dependency.
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index ac03855..abd8415 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1,4 +1,4 @@
-@c Copyright (C) 1988,1989,1992,1993,1994,1996,1998,1999,2000,2001,2002, 2003
+@c Copyright (C) 1988,1989,1992,1993,1994,1996,1998,1999,2000,2001,2002,2003,2004
@c Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@@ -2355,9 +2355,14 @@ and linker.
@item malloc
@cindex @code{malloc} attribute
The @code{malloc} attribute is used to tell the compiler that a function
-may be treated as if it were the malloc function. The compiler assumes
-that calls to malloc result in pointers that cannot alias anything.
+may be treated as if any non-@code{NULL} pointer it returns cannot
+alias any other pointer valid when the function returns.
This will often improve optimization.
+Standard functions with this property include @code{malloc} and
+@code{calloc}. @code{realloc}-like functions have this property as
+long as the old pointer is never referred to (including comparing it
+to the new pointer) after the function returns a non-@code{NULL}
+value.
@item alias ("@var{target}")
@cindex @code{alias} attribute