This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/33873] New: Bad printf warning for bitfield
- From: "ian at airs dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Oct 2007 18:54:17 -0000
- Subject: [Bug c/33873] New: Bad printf warning for bitfield
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider this C code:
#include <stdio.h>
typedef long long int int64;
typedef long long unsigned int uint64;
struct pointer {
uint64 data : 58;
uint64 tag : 6;
};
union value {
int64 i;
struct pointer p;
};
typedef union value Value;
void test(Value x) {
printf("%llu\n", x.p.data);
}
When I compile it with -Wall, I get
foo.c:20: warning: format ?%llu? expects type ?long long unsigned int?, but
argument 2 has type ?long long unsigned int:58?
The value is presumably going to be passed to printf as an unsigned long
long--what else could it be passed as? So this warning seems incorrect.
This may be related to PR 33819.
--
Summary: Bad printf warning for bitfield
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ian at airs dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33873