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
* [Bug c/99295] documentation on __attribute__((malloc)) is wrong
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 ` roland.illig at gmx dot de
2021-02-27 13:04 ` [Bug c/99295] [11 Regression] " redi at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: roland.illig at gmx dot de @ 2021-02-26 23:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295
--- Comment #1 from Roland Illig <roland.illig at gmx dot de> ---
The sentence s3 refers to "this property" as well, and for calloc, the
documentation had been wrong for GCC 4 already since that function returns
zero-initalized memory, not uninitialized memory.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/99295] [11 Regression] documentation on __attribute__((malloc)) is wrong
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 ` redi at gcc dot gnu.org
2021-03-01 9:05 ` rguenth at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2021-02-27 13:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |documentation
Known to work| |10.2.1
Last reconfirmed| |2021-02-27
Status|UNCONFIRMED |NEW
CC| |msebor at gcc dot gnu.org
Summary|documentation on |[11 Regression]
|__attribute__((malloc)) is |documentation on
|wrong |__attribute__((malloc)) is
| |wrong
Ever confirmed|0 |1
Target Milestone|--- |11.0
Known to fail| |11.0
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This changed in dce6c58db87ebf7f4477bd3126228e73e4eeee97
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/99295] [11 Regression] documentation on __attribute__((malloc)) is wrong
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
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-01 9:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/99295] [9/10/11 Regression] documentation on __attribute__((malloc)) is wrong
2021-02-26 23:25 [Bug c/99295] New: documentation on __attribute__((malloc)) is wrong roland.illig at gmx dot de
` (2 preceding siblings ...)
2021-03-01 9:05 ` rguenth at gcc dot gnu.org
@ 2021-03-01 17:46 ` msebor at gcc dot gnu.org
2021-03-02 18:21 ` cvs-commit at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-03-01 17:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.2.1, 9.3.0
Summary|[11 Regression] |[9/10/11 Regression]
|documentation on |documentation on
|__attribute__((malloc)) is |__attribute__((malloc)) is
|wrong |wrong
Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org
Known to work|10.2.1 |8.3.0
Keywords| |patch
Status|NEW |ASSIGNED
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
I agree the insertion of the sentence:
Compiler predicts that a function with the attribute returns non-null in most
cases.
make the following sentence at least ambiguous if not incorrect. The sentence
was added in r263355, in response to pr83023.
I have posted the following change to avoid the unintended reading:
https://gcc.gnu.org/pipermail/gcc-patches/2021-March/566030.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/99295] [9/10/11 Regression] documentation on __attribute__((malloc)) is wrong
2021-02-26 23:25 [Bug c/99295] New: documentation on __attribute__((malloc)) is wrong roland.illig at gmx dot de
` (3 preceding siblings ...)
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
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-02 18:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:
https://gcc.gnu.org/g:397ed1dbffe6c4a48548b601b35699e571e200a3
commit r11-7459-g397ed1dbffe6c4a48548b601b35699e571e200a3
Author: Martin Sebor <msebor@redhat.com>
Date: Tue Mar 2 11:19:49 2021 -0700
PR middle-end/99295 - documentation on __attribute__((malloc)) is wrong
gcc/ChangeLog:
PR middle-end/99295
* doc/extend.texi (attribute malloc): Reword and clarify
nonaliasing
property.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/99295] [9/10 Regression] documentation on __attribute__((malloc)) is wrong
2021-02-26 23:25 [Bug c/99295] New: documentation on __attribute__((malloc)) is wrong roland.illig at gmx dot de
` (4 preceding siblings ...)
2021-03-02 18:21 ` cvs-commit at gcc dot gnu.org
@ 2021-03-02 18:22 ` msebor at gcc dot gnu.org
2021-03-06 22:42 ` roland.illig at gmx dot de
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-03-02 18:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|11.0 |
Summary|[9/10/11 Regression] |[9/10 Regression]
|documentation on |documentation on
|__attribute__((malloc)) is |__attribute__((malloc)) is
|wrong |wrong
Known to work| |11.0
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
r11-7459 updates the GCC 11 manual.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/99295] [9/10 Regression] documentation on __attribute__((malloc)) is wrong
2021-02-26 23:25 [Bug c/99295] New: documentation on __attribute__((malloc)) is wrong roland.illig at gmx dot de
` (5 preceding siblings ...)
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
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: roland.illig at gmx dot de @ 2021-03-06 22:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295
--- Comment #6 from Roland Illig <roland.illig at gmx dot de> ---
Thank you for updating the documentation. It reads really nice now and explains
everything I would need or like to know when I stumble upon this function
attribute.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/99295] [9/10 Regression] documentation on __attribute__((malloc)) is wrong
2021-02-26 23:25 [Bug c/99295] New: documentation on __attribute__((malloc)) is wrong roland.illig at gmx dot de
` (6 preceding siblings ...)
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
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 11:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.0 |11.2
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.1 has been released, retargeting bugs to GCC 11.2.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/99295] [9/10 Regression] documentation on __attribute__((malloc)) is wrong
2021-02-26 23:25 [Bug c/99295] New: documentation on __attribute__((malloc)) is wrong roland.illig at gmx dot de
` (7 preceding siblings ...)
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
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28 7:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.2 |11.3
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.2 is being released, retargeting bugs to GCC 11.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/99295] [9/10 Regression] documentation on __attribute__((malloc)) is wrong
2021-02-26 23:25 [Bug c/99295] New: documentation on __attribute__((malloc)) is wrong roland.illig at gmx dot de
` (8 preceding siblings ...)
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
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-28 17:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Martin Sebor
<msebor@gcc.gnu.org>:
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.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/99295] [9 Regression] documentation on __attribute__((malloc)) is wrong
2021-02-26 23:25 [Bug c/99295] New: documentation on __attribute__((malloc)) is wrong roland.illig at gmx dot de
` (9 preceding siblings ...)
2021-07-28 17:45 ` cvs-commit at gcc dot gnu.org
@ 2021-07-28 17:46 ` msebor at gcc dot gnu.org
2022-03-17 19:41 ` msebor at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-07-28 17:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|10.2.1 |
Summary|[9/10 Regression] |[9 Regression]
|documentation on |documentation on
|__attribute__((malloc)) is |__attribute__((malloc)) is
|wrong |wrong
Target Milestone|11.3 |9.5
--- Comment #10 from Martin Sebor <msebor at gcc dot gnu.org> ---
Backported to GCC 10.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/99295] [9 Regression] documentation on __attribute__((malloc)) is wrong
2021-02-26 23:25 [Bug c/99295] New: documentation on __attribute__((malloc)) is wrong roland.illig at gmx dot de
` (10 preceding siblings ...)
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
11 siblings, 0 replies; 13+ messages in thread
From: msebor at gcc dot gnu.org @ 2022-03-17 19:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|msebor at gcc dot gnu.org |unassigned at gcc dot gnu.org
Status|ASSIGNED |RESOLVED
CC|msebor at gcc dot gnu.org |
Resolution|--- |FIXED
--- Comment #11 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed.
^ 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).