This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: GCC bug report
- From: Jim Wilson <wilson at specifixinc dot com>
- To: Yeh Hong-ming <hongming at cs dot utexas dot edu>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 16 Nov 2003 16:09:53 -0800
- Subject: Re: GCC bug report
- References: <000601c3ac66$aad23390$7e02a8c0@demilune>
Yeh Hong-ming wrote:
*v = *(char*)&q;
Your program is broken. This copies one (1) byte into *v. This is
easier to see if you put a line "x = 0;" before the call to the function
g. Then you will see that the result of the function g is 0x3f and not
the expected 0x6666663f.
This program also has unsafe pointer casts. ISO C says that accessing
an object with a different type (other than char) is undefined. So
"*(float *)&x" has undefined result, and may fail to work as expected.
We prefer bugs put into bugzilla rather than emailed. See
http://gcc.gnu.org/bugs.html
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com