[Bug c/16103] New: -Os does not remove a nested func even when inlined
okuji at enbug dot org
gcc-bugzilla@gcc.gnu.org
Sun Jun 20 18:38:00 GMT 2004
Configured with: ../configure --enable-languages=c
Thread model: posix
gcc version 3.4.0
GCC 3.4.0 seems to inline some nested functions, but sometimes it does not
remove the standalone definitions of them even if they are not referred at all.
This increases the binary size unnecessarily. I compiled my C source file in
this way:
/usr/local/bin/gcc -c -Os -save-temps nested.c
I checked the object file by objdump. This is a small version of the source file
which reproduces the same result:
----------------------------------------------------------
int
next_partition (unsigned long drive, unsigned long dest,
unsigned long *partition, int *type,
unsigned long *start, unsigned long *len,
unsigned long *offset, int *entry,
unsigned long *ext_offset, char *buf)
{
auto int next_bsd_partition (void);
auto int next_pc_slice (void);
int next_bsd_partition (void)
{
return 0;
}
int next_pc_slice (void)
{
return 1;
}
if (*partition != 0xFFFFFF)
{
return next_bsd_partition ();
}
return next_pc_slice ();
}
----------------------------------------------------------
Even though the function next_partition does not call next_bsd_partition.0 or
next_pc_slice.1 in the object file, their defnitions are left.
--
Summary: -Os does not remove a nested func even when inlined
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: okuji at enbug dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16103
More information about the Gcc-bugs
mailing list