Widening bitfields for arguments
Jakub Jelinek
jakub@redhat.com
Wed Apr 25 09:09:00 GMT 2001
Hi!
struct foo
{
unsigned int a:16;
};
void bar (unsigned int);
struct foo x;
void baz (void)
{
bar (x.a);
}
gives a warning with -Wconversion unless -traditional:
passing arg 1 of `bar' as unsigned due to prototype
, but when I tried it on i386 and sparc64 without the
bar prototype, the value was passed zero extended, not
sign extended (unless a's type was changed to int). The
-Wconversion warning is emitted even for:
struct foo
{
unsigned int a:16;
};
void bar (unsigned int);
struct foo x;
void baz (void)
{
bar ((unsigned int)x.a);
}
where it definitely looks like a bug.
Jakub
More information about the Gcc
mailing list