public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114833] New: --suggest-attribute=returns_nonnull misdiagnoses functions with __attribute__((nonnull))
@ 2024-04-24 5:36 eggert at cs dot ucla.edu
2024-04-24 17:32 ` [Bug tree-optimization/114833] " pinskia at gcc dot gnu.org
2024-04-24 17:32 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: eggert at cs dot ucla.edu @ 2024-04-24 5:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114833
Bug ID: 114833
Summary: --suggest-attribute=returns_nonnull misdiagnoses
functions with __attribute__((nonnull))
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: eggert at cs dot ucla.edu
Target Milestone: ---
This is gcc (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0) on Fedora 40 x86-64. Put
this code into the file t.i:
extern char const *foo () __attribute__ ((returns_nonnull));
char const *
foo ()
{
return "abc";
}
and compile it with:
gcc -S -O2 -Wsuggest-attribute=returns_nonnull t.i
The output is:
t.i: In function ‘foo’:
t.i:3:3: warning: function might be candidate for attribute ‘returns_nonnull’
[-Wsuggest-attribute=returns_nonnull]
3 | foo ()
| ^~~
This diagnostic is obviously wrong, as foo is already declared with the
suggested attribute.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/114833] --suggest-attribute=returns_nonnull misdiagnoses functions with __attribute__((nonnull))
2024-04-24 5:36 [Bug tree-optimization/114833] New: --suggest-attribute=returns_nonnull misdiagnoses functions with __attribute__((nonnull)) eggert at cs dot ucla.edu
@ 2024-04-24 17:32 ` pinskia at gcc dot gnu.org
2024-04-24 17:32 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-24 17:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114833
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-04-24
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. The code which calls warn_function_returns_nonnull (or maybe
warn_function_returns_nonnull should do the check) does not check for the
attribute already there.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/114833] --suggest-attribute=returns_nonnull misdiagnoses functions with __attribute__((nonnull))
2024-04-24 5:36 [Bug tree-optimization/114833] New: --suggest-attribute=returns_nonnull misdiagnoses functions with __attribute__((nonnull)) eggert at cs dot ucla.edu
2024-04-24 17:32 ` [Bug tree-optimization/114833] " pinskia at gcc dot gnu.org
@ 2024-04-24 17:32 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-24 17:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114833
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The code to do the warning was added with r14-5628-g53ba8d669550d3 .
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-24 17:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 5:36 [Bug tree-optimization/114833] New: --suggest-attribute=returns_nonnull misdiagnoses functions with __attribute__((nonnull)) eggert at cs dot ucla.edu
2024-04-24 17:32 ` [Bug tree-optimization/114833] " pinskia at gcc dot gnu.org
2024-04-24 17:32 ` pinskia 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).