From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5769 invoked by alias); 23 Apr 2007 18:26:15 -0000 Received: (qmail 5740 invoked by uid 48); 23 Apr 2007 18:26:04 -0000 Date: Mon, 23 Apr 2007 18:26:00 -0000 Subject: [Bug c/31670] New: Error calculating size of structs X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "padrinator at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-04/txt/msg01698.txt.bz2 #include 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