diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2018-11-23 00:18:19 -0500 |
---|---|---|
committer | Sandra Loosemore <sandra@gcc.gnu.org> | 2018-11-23 00:18:19 -0500 |
commit | e0a35f9be5e08b33465999c90a0a3f09d4676da6 (patch) | |
tree | 0a8ebda030ad5bbabbf69df69f7911e8f611f079 | |
parent | 3f317614decc726ef4f7a07d511395cd231caca0 (diff) | |
download | gcc-e0a35f9be5e08b33465999c90a0a3f09d4676da6.zip gcc-e0a35f9be5e08b33465999c90a0a3f09d4676da6.tar.gz gcc-e0a35f9be5e08b33465999c90a0a3f09d4676da6.tar.bz2 |
re PR c/53608 (Documentation could be clearer about designated initializers of unions)
2018-11-22 Sandra Loosemore <sandra@codesourcery.com>
Alan Coopersmith <alan.coopersmith@oracle.com>
PR c/53608
gcc/
* doc/extend.texi (Designated Inits): Clarify handling of multiple
initializers for unions.
Co-Authored-By: Alan Coopersmith <alan.coopersmith@oracle.com>
From-SVN: r266402
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 14 |
2 files changed, 15 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fe222ba..508682f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-11-22 Sandra Loosemore <sandra@codesourcery.com> + Alan Coopersmith <alan.coopersmith@oracle.com> + + PR c/53608 + * doc/extend.texi (Designated Inits): Clarify handling of multiple + initializers for unions. + 2018-11-22 Jan Hubicka <jh@suse.cz> PR lto/88142 diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 858b2d1..91baec3 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -2104,7 +2104,7 @@ Another syntax that has the same meaning, obsolete since GCC 2.5, is struct point p = @{ y: yvalue, x: xvalue @}; @end smallexample -Omitted field members are implicitly initialized the same as objects +Omitted fields are implicitly initialized the same as for objects that have static storage duration. @cindex designators @@ -2162,11 +2162,13 @@ example, with the @samp{struct point} declaration above: struct point ptarray[10] = @{ [2].y = yv2, [2].x = xv2, [0].x = xv0 @}; @end smallexample -@noindent -If the same field is initialized multiple times, it has the value from -the last initialization. If any such overridden initialization has -side effect, it is unspecified whether the side effect happens or not. -Currently, GCC discards them and issues a warning. +If the same field is initialized multiple times, or overlapping +fields of a union are initialized, the value from the last +initialization is used. When a field of a union is itself a structure, +the entire structure from the last field initialized is used. If any previous +initializer has side effect, it is unspecified whether the side effect +happens or not. Currently, GCC discards the side-effecting +initializer expressions and issues a warning. @node Case Ranges @section Case Ranges |