public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bruno at clisp dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/109914] New: --suggest-attribute=pure misdiagnoses static functions Date: Sat, 20 May 2023 09:44:59 +0000 [thread overview] Message-ID: <bug-109914-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109914 Bug ID: 109914 Summary: --suggest-attribute=pure misdiagnoses static functions Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: bruno at clisp dot org CC: marxin at gcc dot gnu.org Target Milestone: --- Created attachment 55125 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55125&action=edit test case GCC's --suggest-attribute=pure diagnoses static functions, even though the 'pure' attribute is useless for static functions (after all, the compiler has deduced the property on its own). This is leading to my having to litter code with '__attribute__ (pure)' declarations merely to pacify GCC. GCC should treat the 'pure' attribute like other attributes (e.g., malloc, const), and should issue the diagnostic only for non-static functions where the attribute is in fact useful. How to reproduce: $ gcc --version gcc (GCC) 13.1.0 ... $ gcc -Wsuggest-attribute=pure -O2 -S file-has-acl.c file-has-acl.c: In function ‘have_xattr’: file-has-acl.c:3385:14: warning: function might be candidate for attribute ‘pure’ if it is known to return normally [-Wsuggest-attribute=pure] 3385 | static _Bool have_xattr (char const *attr, char const *listbuf, ssize_t listsize) | ^~~~~~~~~~
next reply other threads:[~2023-05-20 9:45 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-20 9:44 bruno at clisp dot org [this message] 2023-05-20 14:47 ` [Bug ipa/109914] " pinskia at gcc dot gnu.org 2023-05-28 20:15 ` hubicka at gcc dot gnu.org 2023-05-28 22:16 ` bruno at clisp dot 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-109914-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: linkBe 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).