public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99295] New: documentation on __attribute__((malloc)) is wrong
@ 2021-02-26 23:25 roland.illig at gmx dot de
  2021-02-26 23:27 ` [Bug c/99295] " roland.illig at gmx dot de
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: roland.illig at gmx dot de @ 2021-02-26 23:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295

            Bug ID: 99295
           Summary: documentation on __attribute__((malloc)) is wrong
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roland.illig at gmx dot de
  Target Milestone: ---

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html says:
> (s1) Using the attribute with no arguments is designed to improve
> optimization.
> (s2) The compiler predicts that a function with the attribute returns
> non-null in most cases.
> (s3) Functions like malloc and calloc have this property because
> they return a pointer to uninitialized or zeroed-out storage.
> (s4) However, functions like realloc do not have this property,
> as they may return pointers to storage containing pointers to
> existing objects.

In GCC 4, the text was different and made sense.

At some later point, the sentence s2 was rewritten. The sentence s4
still refers to s2, but the "do not have this property" no longer
applies. In GCC 4, "this property" was "returns uninitialized memory",
while in GCC 11, "this property" is "returns non-NULL in most cases".

The documentation should be made coherent again.

https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Function-Attributes.html
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-03-17 19:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26 23:25 [Bug c/99295] New: documentation on __attribute__((malloc)) is wrong roland.illig at gmx dot de
2021-02-26 23:27 ` [Bug c/99295] " roland.illig at gmx dot de
2021-02-27 13:04 ` [Bug c/99295] [11 Regression] " redi at gcc dot gnu.org
2021-03-01  9:05 ` rguenth at gcc dot gnu.org
2021-03-01 17:46 ` [Bug c/99295] [9/10/11 " msebor at gcc dot gnu.org
2021-03-02 18:21 ` cvs-commit at gcc dot gnu.org
2021-03-02 18:22 ` [Bug c/99295] [9/10 " msebor at gcc dot gnu.org
2021-03-06 22:42 ` roland.illig at gmx dot de
2021-04-27 11:40 ` jakub at gcc dot gnu.org
2021-07-28  7:06 ` rguenth at gcc dot gnu.org
2021-07-28 17:45 ` cvs-commit at gcc dot gnu.org
2021-07-28 17:46 ` [Bug c/99295] [9 " msebor at gcc dot gnu.org
2022-03-17 19:41 ` msebor at gcc dot gnu.org

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).