This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14750] type-punned pointer causes bad code
- From: "lindsayd at cisco dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Mar 2004 04:09:41 -0000
- Subject: [Bug c/14750] type-punned pointer causes bad code
- References: <20040327035806.14750.lindsayd@cisco.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From lindsayd at cisco dot com 2004-03-27 04:09 -------
The above got committed before I was finished. Sigh.
What's right about these four lines is that they store two halfwords (with "sh")
and load a word (with "lw"). What's wrong is that they do it in the order
{store,load,store}, not {store,store,load}. So the result (the returned word)
contains 16 uninitialized bits from the stack frame. That's not OK.
The latest 3.4 snapshot has this behavior. I believe 3.3 has the same problem:
at least, it did in December.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14750