This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/26850] New: unused function not eliminated with -fwhole-program --combine
- From: "dann at godzilla dot ics dot uci dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Mar 2006 16:24:46 -0000
- Subject: [Bug tree-optimization/26850] New: unused function not eliminated with -fwhole-program --combine
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compile these 2 files with gcc -O2 -fwhole-program --combine a.c b.c
a.c:
int main (void) { return 0;}
b.c:
static int tst1 (int x) {return x;}
static int global_static;
int global;
int tst2 (int x, int y) {foo (tst1, x, y, &global_static, &global);}
The generated assembly still contains the tst1 function. tst2, global and
static_global have been eliminated.
It seems that functions that have their address taken should be reconsidered
for elimination after eliminating the functions (and variables too) that took
their address.
Note that in the above case compiling the files separately will generate less
code as the whole b.o file will be eliminated by the linker...
--
Summary: unused function not eliminated with -fwhole-program --
combine
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dann at godzilla dot ics dot uci dot edu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26850