https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82296

--- Comment #3 from Ingo <lundril at gmx dot de> ---
Just to be sure:

On a real machine this code is certainly not "undefined behavior", because
gMyUnion.numbers[ARRAYSIZE] aliases gMyUnion.dummy[ARRAYSIZE] and
gMyUnion.dummy[ARRAYSIZE] is a valid memory location.

So I guess there somewhere is a paragraph in the C language specification,
which says "this is undefined behavior", even if declaring this "undefined"
probably contradicts the semantics of unions and pointer arithmetic (specified
in the same said C language specification).

And just because there is this paragraph in the C language specification, the
compiler is then allowed to produce "random" code ?

Reply via email to