file test.c: ---------------------- enum stdcolor_enum { black, blue, green, cyan, red, magenta, brown, lightgray, darkgray, lightblue, lightgreen, lightcyan, lightred, lightmagenta, yellow, white };
union mouse_color_union { struct mouse_color_str { unsigned deflt : 4; unsigned leftbutton : 4; unsigned rightbutton : 4; unsigned middlebutton : 4; unsigned topbutton : 4; unsigned twobutton : 4; unsigned invalid : 4; unsigned infield : 4; } colors; unsigned all; } conf; const union mouse_color_union MOUSE_reset_colors = { .colors = { .deflt = brown, .leftbutton = red, .rightbutton = green, .middlebutton = lightcyan, .topbutton = cyan, .twobutton = magenta, .invalid = black, .infield = magenta, }}; void fct (void) { conf = MOUSE_reset_colors; } ---------------------- $ gcc-4.2 --version gcc-4.2 (GCC) 4.2.4 (Debian 4.2.4-3) Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ gcc-4.2 -Os -c test.c -o test.o-4.2 $ size test.o-4.2 text data bss dec hex filename 19 0 0 19 13 test.o-4.2 $ gcc-4.3 --version gcc-4.3 (Debian 4.3.1-9) 4.3.1 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ gcc-4.3 -Os -c test.c -o test.o-4.3 $ size test.o-4.3 text data bss dec hex filename 56 0 0 56 38 test.o-4.3 Basically, the assembler lines in gcc-4.2: movl MOUSE_reset_colors, %eax movl %eax, conf becomes in 4.3: movl $0, conf movb conf+3, %al movb $70, conf andl $15, %eax orl $80, %eax movb $-78, conf+1 movb $83, conf+2 movb %al, conf+3 which looks like a regression. Thanks, etienne. -- Summary: code size increase from gcc-4.2.4-3 to 4.3.1-9 for simple fct Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: etienne_lorrain at yahoo dot fr GCC build triplet: debian GCC host triplet: i386-linux-debian GCC target triplet: i386-linux-debian http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37135