This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/26850] New: unused function not eliminated with -fwhole-program --combine


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]