diff mbox series

v2: doc/implement-c.texi: About same-as-scalar-type volatile aggregate accesses, PR94600

Message ID 20201203191409.3906D203C3@pchp3.se.axis.com
State New
Headers show
Series v2: doc/implement-c.texi: About same-as-scalar-type volatile aggregate accesses, PR94600 | expand

Commit Message

Hans-Peter Nilsson Dec. 3, 2020, 7:14 p.m. UTC
Belatedly, here's an updated version, using Martin Sebor's
suggested wording from
"https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549580.html".
I added two commas, hopefully helpfully.  Albeit ok'd by Richard
Biener in
"https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549922.html",
better have this reviewed properly, including markup (none added).

Ok for trunk (gcc-11) and gcc-10?


---
We say very little about reads and writes to aggregate /
compound objects, just scalar objects (i.e. assignments don't
cause reads).  Let's lets say something safe about aggregate
objects, but only for those that are the same size as a scalar
type.

There's an equal-sounding section (Volatiles) in extend.texi,
but this seems a more appropriate place, as specifying the
behavior of a standard qualifier.

gcc:

2020-12-02  Hans-Peter Nilsson  <hp@axis.com>
	    Martin Sebor  <msebor@redhat.com>

	PR middle-end/94600
	* doc/implement-c.texi (Qualifiers implementation): Add blurb
 	about access to the whole of a volatile aggregate object, only for
 	same-size as a scalar object.
---
 gcc/doc/implement-c.texi | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Martin Sebor Dec. 4, 2020, 12:49 a.m. UTC | #1
On 12/3/20 12:14 PM, Hans-Peter Nilsson via Gcc-patches wrote:
> Belatedly, here's an updated version, using Martin Sebor's
> suggested wording from
> "https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549580.html".
> I added two commas, hopefully helpfully.  Albeit ok'd by Richard
> Biener in
> "https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549922.html",
> better have this reviewed properly, including markup (none added).
> 
> Ok for trunk (gcc-11) and gcc-10?

Thanks for taking my suggestion!

These are just formatting nits but I would only further suggest
to enclose the name S (since it names a type) and the second
volatile in an @code{} directive (since it's a keyword).
(The volatile in volatile access is not one so it shouldn't
be formatted that way.)

Martin

> 
> 
> ---
> We say very little about reads and writes to aggregate /
> compound objects, just scalar objects (i.e. assignments don't
> cause reads).  Let's lets say something safe about aggregate
> objects, but only for those that are the same size as a scalar
> type.
> 
> There's an equal-sounding section (Volatiles) in extend.texi,
> but this seems a more appropriate place, as specifying the
> behavior of a standard qualifier.
> 
> gcc:
> 
> 2020-12-02  Hans-Peter Nilsson  <hp@axis.com>
> 	    Martin Sebor  <msebor@redhat.com>
> 
> 	PR middle-end/94600
> 	* doc/implement-c.texi (Qualifiers implementation): Add blurb
>   	about access to the whole of a volatile aggregate object, only for
>   	same-size as a scalar object.
> ---
>   gcc/doc/implement-c.texi | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/gcc/doc/implement-c.texi b/gcc/doc/implement-c.texi
> index 692297b69c4..2e9158a2a45 100644
> --- a/gcc/doc/implement-c.texi
> +++ b/gcc/doc/implement-c.texi
> @@ -576,6 +576,11 @@ are of scalar types, the expression is interpreted by GCC as a read of
>   the volatile object; in the other cases, the expression is only evaluated
>   for its side effects.
>   
> +When an object of an aggregate type, with the same size and alignment as a
> +scalar type S, is the subject of a volatile access by an assignment
> +expression or an atomic function, the access to it is performed as if the
> +object's declared type were volatile S.
> +
>   @end itemize
>   
>   @node Declarators implementation
>
diff mbox series

Patch

diff --git a/gcc/doc/implement-c.texi b/gcc/doc/implement-c.texi
index 692297b69c4..2e9158a2a45 100644
--- a/gcc/doc/implement-c.texi
+++ b/gcc/doc/implement-c.texi
@@ -576,6 +576,11 @@  are of scalar types, the expression is interpreted by GCC as a read of
 the volatile object; in the other cases, the expression is only evaluated
 for its side effects.
 
+When an object of an aggregate type, with the same size and alignment as a
+scalar type S, is the subject of a volatile access by an assignment
+expression or an atomic function, the access to it is performed as if the
+object's declared type were volatile S.
+
 @end itemize
 
 @node Declarators implementation