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 c/30075] New: Missed optimizations with -fwhole-program -combine


---
atropine:~/combine-bug% cat foo.c
int foo(void) {
    return 0;
}

atropine:~/combine-bug% cat bar.c 
extern int foo(void);

void *array[] = {
    foo
};

atropine:~/combine-bug% gcc -shared -fPIC -combine -fwhole-program -o libfoo.so
foo.c bar.c
atropine:~/combine-bug% nm libfoo.so | egrep '(foo)|(array)'
000000000000048c t foo
atropine:~/combine-bug% rpm -q gcc
gcc-4.1.1-30
---

foo is still emitted, when you'd think you could garbage-collect it, since the
array that references it has fallen out of existance.  If you use
-fvisibility=hidden instead of -fwhole-program the result is even worse, both
foo and array are emitted even though the resulting DSO does not give any
access to them.


-- 
           Summary: Missed optimizations with -fwhole-program -combine
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ajax at redhat dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30075


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