From: David Malcolm <dmalcolm@redhat.com>
To: linux-sparse@vger.kernel.org, linux-toolchains@vger.kernel.org
Cc: David Faust <david.faust@oracle.com>,
Julia Lawall <julia.lawall@inria.fr>,
"Jose E. Marchesi" <jose.marchesi@oracle.com>,
Elena Zannoni <elena.zannoni@oracle.com>
Subject: address_space and noderef on non-pointer types
Date: Thu, 13 Oct 2022 15:37:16 -0400 [thread overview]
Message-ID: <e583356b104fbef6940a06bf360aa59c42bba3c2.camel@redhat.com> (raw)
Is it valid to apply the sparse attributes 'noderef' or 'address_space'
to non-pointers, and if so, what does this mean?
I see examples of using them on non-pointers in sparse's own test
suite.
For example, in:
https://git.kernel.org/pub/scm/devel/sparse/sparse.git/tree/validation/type-attribute-as.c
"struct s" is annotated with
__attribute__((address_space(__as)))
Similarly, there's
https://git.kernel.org/pub/scm/devel/sparse/sparse.git/tree/validation/noderef.c#n18
where sparse accepts:
struct x __A x;
e.g.:
struct x __attribute__((noderef)) x;
The docs for noderef:
https://git.kernel.org/pub/scm/devel/sparse/sparse.git/tree/Documentation/annotations.rst#n54
say:
"This attribute is to be used on a r-value to specify it cannot be
dereferenced. A pointer so annotated is in all other aspects exactly
like a pointer but trying to actually access anything through it will
cause a warning."
What is the intended meaning of "noderef" for a non-pointer?
Similarly, the docs for "address_space" say:
"This attribute is to be used on pointers to specify that its target is
in address space *name* (an identifier or a constant integer)."
but don't specify what it means to use in on a non-pointer.
Sorry if this is a silly question.
The background here is that I'm a GCC developer and have been
experimenting with implementing some sparse attributes and warnings
"natively" in GCC; see e.g. the RFE in GCC bugzilla for implementing
address_space, noderef and force here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59850 ; I'm trying to get
my patched GCC to handle Sparse's own test suite and hence running into
this issue.
Thanks
Dave
next reply other threads:[~2022-10-13 19:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 19:37 David Malcolm [this message]
2022-10-13 23:21 ` address_space and noderef on non-pointer types Linus Torvalds
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=e583356b104fbef6940a06bf360aa59c42bba3c2.camel@redhat.com \
--to=dmalcolm@redhat.com \
--cc=david.faust@oracle.com \
--cc=elena.zannoni@oracle.com \
--cc=jose.marchesi@oracle.com \
--cc=julia.lawall@inria.fr \
--cc=linux-sparse@vger.kernel.org \
--cc=linux-toolchains@vger.kernel.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 NNTP newsgroup(s).