[Bug c/31670] New: Error calculating size of structs
padrinator at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Apr 23 18:26:00 GMT 2007
#include <stdio.h>
typedef struct{
char data[261];
int n;
} packet;
int main(int argc, char *argv[]){
packet p;
//It should print packet=265... it prints packet=268
printf("packet = %d\n", sizeof(packet));
//It should print p=265... it prints p=268
printf("p = %d\n", sizeof(p));
//It should print p.n=4... OK
printf("p.n = %d\n", sizeof(p.n));
//It should print p.data=261... OK
printf("p.data = %d\n", sizeof(p.data));
return 0;
}
--
Summary: Error calculating size of structs
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: padrinator at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31670
More information about the Gcc-bugs
mailing list