[Bug c/82105] unexpected padding in a struct

2017-09-10 Thread dudu.arbel at ilrd dot co.il
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82105 --- Comment #9 from Dudu --- So, Andreas, why this struct's size is 16? typedef struct { long x:16; int y:17; short z; } SizeofThisIs16;

[Bug c/82105] unexpected padding in a struct

2017-09-05 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82105 --- Comment #8 from Andrew Pinski --- (In reply to Dudu from comment #7) > By the way: if you use long instead of int - you get no padding between x > and y, so the size of the struct is smaller!!! > > typedef struct { > unsigned long x:16

[Bug c/82105] unexpected padding in a struct

2017-09-05 Thread dudu.arbel at ilrd dot co.il
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82105 --- Comment #7 from Dudu --- By the way: if you use long instead of int - you get no padding between x and y, so the size of the struct is smaller!!! typedef struct { unsigned long x:16; unsigned long y:17; unsigned short

[Bug c/82105] unexpected padding in a struct

2017-09-05 Thread dudu.arbel at ilrd dot co.il
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82105 --- Comment #6 from Dudu --- Thanks for the replies, but I do not look to workaround this issue. I simply wonder why gcc behaves as it does on this case. This behavior breaks my understanding of padding. This behavior seems wrong. This behavior l

[Bug c/82105] unexpected padding in a struct

2017-09-05 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82105 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org --- Comment

[Bug c/82105] unexpected padding in a struct

2017-09-05 Thread dudu.arbel at ilrd dot co.il
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82105 --- Comment #4 from Dudu --- Sorry, Andreas I don't understand your comment - can you please explain?

[Bug c/82105] unexpected padding in a struct

2017-09-05 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82105 --- Comment #3 from Andreas Schwab --- Bit fields are not allocated across unit boundaries.

[Bug c/82105] unexpected padding in a struct

2017-09-05 Thread dudu.arbel at ilrd dot co.il
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82105 --- Comment #2 from Dudu --- I don't think this is how bitfields works. In the following structs there are no padding between x an y typedef struct { unsigned int x:1; unsigned int y:1; unsigned short z; } XXX; nor in th

[Bug c/82105] unexpected padding in a struct

2017-09-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82105 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---