This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

Re: next bug


John Carr <jfc@mit.edu> writes:

> 6.3 #6/#7 combine to cause undefined behavior for similar code using a
> dynamically allocated union.
> [...]
> Where does the C standard define what value you get when you store a
> double and read back an integer?  The integer field is uninitialized.

OK, it is left _implementation-defined_, but it is not illegal.  That
is my point.  Plus, the footnote 67 explicitly mentions this case of
accessing a value using two different union elements.

Together with the practice (this is the method advised for years) gcc
should be changed (and the behaviour should be documented).


Anyhow, the bug cannot be explained only by using this undefined method
only so we are in fact talking about two different things.

-- Uli
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------


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