public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* long long bit-fields
@ 2003-03-30 19:14 Falk Hueffner
  2003-03-31  8:46 ` Segher Boessenkool
  0 siblings, 1 reply; 4+ messages in thread
From: Falk Hueffner @ 2003-03-30 19:14 UTC (permalink / raw)
  To: gcc

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-04-01  0:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-30 19:14 long long bit-fields Falk Hueffner
2003-03-31  8:46 ` Segher Boessenkool
2003-03-31  9:22   ` Falk Hueffner
2003-04-01  0:11     ` Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).