middle-end/7018: bitfield of type long long treated as int in shift
Christian Ehrhardt
ehrhardt@mathematik.uni-ulm.de
Thu Apr 10 14:09:00 GMT 2003
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7018
This PR is about this piece of code and it complains that the bitfield
is promoted to int instead of unsigned long long in the return statement:
struct s {
unsigned long long uf:1;
};
unsigned long long utest(const struct s*ps) {
return ps->uf << 32;
}
IMHO this is behaviour is correct but the standard is somewhat vague
wrt. bit-fields of other types than _Bool, char and int, so I need a
language lawyer to make the final decision.
The standard does state quite clearly that an unsigned int bitfield
with a width less than that of int has to be promoted to int and not to
unsigend int, i.e. there is no implicit conversion of the bitfield to
its "container type".
regards Christian
--
THAT'S ALL FOLKS!
More information about the Gcc-bugs
mailing list