From: sandra Date: Fri, 23 Nov 2018 05:18:19 +0000 (+0000) Subject: 2018-11-22 Sandra Loosemore X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb2b94e405f954d18b0a4e879b2386d68224f258;p=thirdparty%2Fgcc.git 2018-11-22 Sandra Loosemore Alan Coopersmith PR c/53608 gcc/ * doc/extend.texi (Designated Inits): Clarify handling of multiple initializers for unions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266402 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fe222bad9e0f..508682f86eb2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-11-22 Sandra Loosemore + Alan Coopersmith + + PR c/53608 + * doc/extend.texi (Designated Inits): Clarify handling of multiple + initializers for unions. + 2018-11-22 Jan Hubicka PR lto/88142 diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 858b2d154409..91baec3c886f 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