Compiling this code with -Os is more than 40 % bigger in size with GCC-4.1 compared to GCC-3.4.3. See also thread: http://gcc.gnu.org/ml/gcc/2005-05/msg00532.html >>>> struct disk_interface_str { unsigned nb_IDE_found; struct IDE_found_str { unsigned short ideIOadr; unsigned short ideIOctrladr; unsigned char irq; unsigned char bios_order; unsigned short reserved; } *IDE_found; } DI;
void reorder_IDE_for_linux (void) { static const unsigned short idearray[] = { 0x1F0, 0x170, 0x1E8, 0x168, 0x1E0, 0x160, }; unsigned short cpt, order; for (order = 0; order < sizeof(idearray)/sizeof(idearray[0]); order++) { for (cpt = order + 1; cpt < DI.nb_IDE_found; cpt++) if (DI.IDE_found[cpt].ideIOadr == idearray[order]) break; if (cpt < DI.nb_IDE_found) { struct IDE_found_str save = DI.IDE_found[cpt]; unsigned short i; for (i = order; i < cpt; i++) { struct IDE_found_str tmp = DI.IDE_found[i]; DI.IDE_found[i] = save; save = tmp; } DI.IDE_found[cpt] = save; } } } <<<< -- Summary: code size regression (+40%) with -Os from GCC-3.4.3 to 4.1 Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: etienne_lorrain at yahoo dot fr CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i486-pc-linux-gnu GCC host triplet: i486-pc-linux-gnu GCC target triplet: i486-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21529