http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59479
Bug ID: 59479 Summary: Inlining of static function bloats code size when Os Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: amker.cheng at gmail dot com Created attachment 31424 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31424&action=edit The preprocessed file for newlib/libc/stdio/findfp.c Hi, for attached preprocessed code from newlib/libc/stdio/findfp.c, GCC inlines static function `std' even when optimizing for Os. With command line: $ ./arm-none-eabi-gcc -Os -mthumb -mcpu=cortex-m0 -c -xc findfp.E -o findfp.o The dumped symbols are like: 21: 00000009 16 FUNC GLOBAL DEFAULT 1 _cleanup_r ... 29: 00000055 224 FUNC GLOBAL DEFAULT 1 __sinit ... 41: 000001d5 24 FUNC GLOBAL DEFAULT 1 __fp_unlock_all With command line: $ ./arm-none-eabi-gcc -Os -mthumb -mcpu=cortex-m0 -c -xc findfp.E -o findfp.o -fno-inline The dumped symbols are like: 9: 00000018 0 NOTYPE LOCAL DEFAULT 1 $t 10: 00000019 72 FUNC LOCAL DEFAULT 1 std.isra.0 ... 24: 00000009 16 FUNC GLOBAL DEFAULT 1 _cleanup_r ... 36: 0000009d 80 FUNC GLOBAL DEFAULT 1 __sinit This occurs on trunk and 4_8 branch.