This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/65331] C99 format macros doesn't accept bit fields for 64-bit integer types
- From: "dmitry.petroff at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 06 Mar 2015 14:00:25 +0000
- Subject: [Bug c/65331] C99 format macros doesn't accept bit fields for 64-bit integer types
- Auto-submitted: auto-generated
- References: <bug-65331-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65331
--- Comment #1 from Dmitry Petrov <dmitry.petroff at gmail dot com> ---
UPD: it appears that bug doesn't related to PRI* format specifiers:
-m64:
printf("%lu\n", value); // usigned long value:31 => error (ok)
printf("%lu\n", value); // usigned long value:33 => error (not ok IMHO)
-m32
printf("%lu\n", value); // usigned long long value:31 => compiles (ok)
printf("%llu\n", value); // usigned long long value:33 => error (not ok IMHO)
It seems that bit fields wider than 32 bits are'n treated as 64 bit integers
and need an explicit cast while fields of 32 bits width and less are propagated
to 32-bit integer type (int/unsigned int) and work just fine.