This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/41793] [4.3/4.4/4.5 Regression] About Long long bit field
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Oct 2009 16:12:12 -0000
- Subject: [Bug c/41793] [4.3/4.4/4.5 Regression] About Long long bit field
- References: <bug-41793-17793@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from jakub at gcc dot gnu dot org 2009-10-22 16:12 -------
If you bothered to use -Wall, you would see.
/tmp/x.c:13:3: warning: format â??%llxâ?? expects type â??long long unsigned
intâ??, but argument 2 has type â??intâ??
/tmp/x.c:14:3: warning: format â??%llxâ?? expects type â??long long unsigned
intâ??, but argument 2 has type â??long unsigned int:40â??
/tmp/x.c:15:3: warning: format â??%llxâ?? expects type â??long long unsigned
intâ??, but argument 2 has type â??intâ??
All 3 are undefined behavior, but on i386 when pushing an int argument means
pushing 32-bit value and reading 64-bit value means reading 2 32-bit values
from the stack, you can clearly understand that the upper 32 bits aren't
initialized, are whatever happened to be on the stack. In your case those are
the bits from the earlier push.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41793