public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vultkayn at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug analyzer/106390] Support gsl::owner<T> and/or [[gnu::owner]] attribute in -fanalyzer
Date: Thu, 08 Jun 2023 17:00:31 +0000	[thread overview]
Message-ID: <bug-106390-4-X0uennqqjw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106390-4@http.gcc.gnu.org/bugzilla/>

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

Benjamin Priour <vultkayn at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vultkayn at gcc dot gnu.org

--- Comment #3 from Benjamin Priour <vultkayn at gcc dot gnu.org> ---
I think gsl::owner might be insufficient and we should rather introduce
[[gnu::owner(unique)]] and [[gnu::owner(shared)]] 

Let's say we only had [[gnu::owner]] for ownership, whether unique or shared.
If so, annotating [[gnu::owner]] would mean "I am becoming A (not THE) owner of
the given resource", i.e. it would always mean "shared" ownership.

Yet doing so would make the attribute only useful to check spurious
deallocations of non-owned resource, as well as detect the resource has been
released in the destructor, but otherwise useless to check move operations, as
we cannot require a move upon acquiring a shared resource.

Thus an additional attribute will be necessary anyway, either to differentiate
"shared" and "unique" ownership, or to annotate a move operation. 

I believe [[gnu::owner(unique|shared)]] to be preferable, as we can use it to
deduce a move operation, whereas a flagged move does not induce the quality of
ownership.

  parent reply	other threads:[~2023-06-08 17:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 17:38 [Bug analyzer/106390] New: " redi at gcc dot gnu.org
2022-07-21 17:43 ` [Bug analyzer/106390] " redi at gcc dot gnu.org
2022-07-21 17:46 ` redi at gcc dot gnu.org
2023-06-08 17:00 ` vultkayn at gcc dot gnu.org [this message]
2023-06-08 19:17 ` redi at gcc dot gnu.org
2023-06-08 19:44 ` vultkayn at gcc dot gnu.org
2024-03-04 15:58 ` redi 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-106390-4-X0uennqqjw@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).