This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
long long bit-fields
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: gcc at gcc dot gnu dot org
- Date: 30 Mar 2003 14:45:02 +0200
- Subject: long long bit-fields
Hi,
PR c/6346, middle-end/7018 and target/9620 deal with long long
bit-fields. I guess part of the confusion comes from the fact that the
C standard doesn't specify how they should behave (at least I couldn't
find it). So what is the following program supposed to print?
#include <stdio.h>
int
main(int argc, char *argv[]){
struct {
unsigned long long ull31a: 31;
unsigned long long ull31b: 31;
} x;
x.ull31a = -1;
x.ull31b = 1;
printf("%016llx %016llx %016llx\n",
(x.ull31a << 48) >> 48,
(x.ull31a << 16),
(x.ull31b << 48));
}
Candidates are:
ffffffffffffffff ffffffffffff0000 0000000000010000 (gcc)
ffffffffffffffff 00007fffffff0000 0001000000000000 (Compaq C)
000000000000ffff 00007fffffff0000 0001000000000000 (g++)
0000000000000000 ffffffffffff0000 0000000000000000 (Compaq C++)
--
Falk