This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/30075] New: Missed optimizations with -fwhole-program -combine
- From: "ajax at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Dec 2006 18:43:12 -0000
- Subject: [Bug c/30075] New: Missed optimizations with -fwhole-program -combine
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
---
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