public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-10009] Backport from GCC 11 [PR99295].
@ 2021-07-28 17:45 Martin Sebor
0 siblings, 0 replies; only message in thread
From: Martin Sebor @ 2021-07-28 17:45 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9d9cebd9205c7e28bd4d76c39dd9a643018791af
commit r10-10009-g9d9cebd9205c7e28bd4d76c39dd9a643018791af
Author: Martin Sebor <msebor@redhat.com>
Date: Wed Jul 28 11:43:33 2021 -0600
Backport from GCC 11 [PR99295].
gcc/ChangeLog:
PR c/99295
* doc/extend.texi (attribute malloc): Reword and clarify nonaliasing
property.
Diff:
---
gcc/doc/extend.texi | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index afa87d89d5f..dd04dd27264 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3228,15 +3228,18 @@ calls.
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. Compiler predicts
-that a function with the attribute returns non-null in most cases.
-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.
+pointers to valid objects occur in any storage addressed by @var{P}. In
+addition, GCC predicts that a function with the attribute returns
+non-null in most cases.
+
+Using the attribute is designed to improve optimization
+by relying on the aliasing property it implies. Functions like @code{malloc}
+and @code{calloc} have this property because they return a pointer to
+uninitialized or zeroed-out, newly obtained storage. However, functions
+like @code{realloc} do not have this property, as they may return pointers
+to storage containing pointers to existing objects. Additionally, since
+all such functions are assumed to return null only infrequently, callers
+can be optimized based on that assumption.
@item no_icf
@cindex @code{no_icf} function attribute
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-28 17:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28 17:45 [gcc r10-10009] Backport from GCC 11 [PR99295] Martin Sebor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).