This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug compile/22084] unexpected padding in a struct
- From: "dudu.arbel at ilrd dot co.il" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Tue, 05 Sep 2017 12:03:09 +0000
- Subject: [Bug compile/22084] unexpected padding in a struct
- Auto-submitted: auto-generated
- References: <bug-22084-4717@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=22084
--- Comment #2 from Dudu <dudu.arbel at ilrd dot co.il> ---
I use gcc.
the whole file to compile is:
#include "stdio.h"
typedef struct {
unsigned int x:16;
unsigned int y:17;
unsigned short z;
} XXX;
int main()
{
XXX x = {0};
x.x = 65536-1;
x.y = 2*65536-1;
x.z = 65536-1;
char *p = (char*)&x;
printf("1st byte is=%d\n", *p++);
printf("2nd byte is=%d\n", *p++);
printf("3rd byte is=%d\n", *p++);
printf("\nsize of xxx=%ld\n", sizeof(XXX));
}
the output is: -1 (ok), -1 (ok), 0 (!? - wrong padding)
--
You are receiving this mail because:
You are on the CC list for the bug.