This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Undefined behavior due to

On 2015-03-12 00:19:55 +0100, Robbert Krebbers wrote:
> On 03/11/2015 05:31 PM, Vincent Lefevre wrote:
> >I disagree that it is an extension. The standard does not say
> >that "one union member can be active at any time".
> >
> >The interpretation under which this is allowed in confirmed by
> >Note 95 of
> Effective types disallow to access a union member other than the current one
> arbitrarily, so naively effective types contradict note 95 of

Well, this depends on the interpretation of effective types in the
case of a union. For instance, when writing

  union { char a[16]; int b; } u;
  u.b = 1;

you don't set the member only (an int), but the whole union object is
affected, even bytes that are not parts of the int. So, one may see
the effective type as being the union type.

The item "an aggregate or union type that includes one of the
aforementioned types among its members (including, recursively,
a member of a subaggregate or contained union), or" about aliasing
is also very unclear.

If you think that something contradicts note 95, you should write a
defect report.

Vincent Lefèvre <> - Web: <>
100% accessible validated (X)HTML - Blog: <>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]