GCC bug report
Jim Wilson
wilson@specifixinc.com
Mon Nov 17 00:10:00 GMT 2003
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
More information about the Gcc-bugs
mailing list