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]

[Bug c/41793] [4.3/4.4/4.5 Regression] About Long long bit field



------- 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


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