diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-23 10:11:03 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-23 10:11:03 +0000 |
commit | 9e23707396c96aecbd2fe45dcd11dea0012d03ed (patch) | |
tree | 164c14173384077c10ad3af500426be2a8e5259e | |
parent | c2bcf3c3398f7a69748e97249eb88617375277db (diff) | |
download | gcc-9e23707396c96aecbd2fe45dcd11dea0012d03ed.tar.gz |
2014-05-22 Paul Eggert <eggert@cs.ucla.edu>
PR other/56955
* doc/extend.texi (Function Attributes): Fix __attribute__ ((malloc))
documentation; the old documentation didn't clearly state the
constraints on the contents of the pointed-to storage.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210848 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 18 |
2 files changed, 17 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bada3316941..aedf2d0a099 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-05-23 Paul Eggert <eggert@cs.ucla.edu> + + PR other/56955 + * doc/extend.texi (Function Attributes): Fix __attribute__ ((malloc)) + documentation; the old documentation didn't clearly state the + constraints on the contents of the pointed-to storage. + 2014-05-23 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> Fix bootstrap error on ia64 diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 28eb8aefa0a..c54ed6785d6 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -3207,14 +3207,16 @@ efficient @code{jal} instruction. @item malloc @cindex @code{malloc} attribute -The @code{malloc} attribute is used to tell the compiler that a function -may be treated as if any non-@code{NULL} pointer it returns cannot -alias any other pointer valid when the function returns and that the memory -has undefined content. -This often improves optimization. -Standard functions with this property include @code{malloc} and -@code{calloc}. @code{realloc}-like functions do not have this -property as the memory pointed to does not have undefined content. +This tells the compiler that a function is @code{malloc}-like, i.e., +that the pointer @var{P} returned by the function cannot alias any +other pointer valid when the function returns, and moreover no +pointers to valid objects occur in any storage addressed by @var{P}. + +Using this attribute can improve optimization. Functions like +@code{malloc} and @code{calloc} have this property because they return +a pointer to uninitialized or zeroed-out storage. However, functions +like @code{realloc} do not have this property, as they can return a +pointer to storage containing pointers. @item mips16/nomips16 @cindex @code{mips16} attribute |