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]
Other format: [Raw text]

Re: GCC bug report


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


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