This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: next bug
- To: John Carr <jfc at mit dot edu>
- Subject: Re: next bug
- From: Ulrich Drepper <drepper at cygnus dot com>
- Date: 28 Apr 1998 17:28:44 -0700
- Cc: Jim Wilson <wilson at cygnus dot com>, egcs-bugs at cygnus dot com
- References: <199804282357.TAA05142@jfc.>
- Reply-To: drepper at cygnus dot com (Ulrich Drepper)
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 `------------------------