[Bug c/41793] [4.3/4.4/4.5 Regression] About Long long bit field
jakub at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Oct 22 16:12:00 GMT 2009
------- 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
More information about the Gcc-bugs
mailing list