public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "roland.illig at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/99295] New: documentation on __attribute__((malloc)) is wrong
Date: Fri, 26 Feb 2021 23:25:38 +0000	[thread overview]
Message-ID: <bug-99295-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2021-02-26 23:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26 23:25 roland.illig at gmx dot de [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-99295-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).