From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6220 invoked by alias); 5 Dec 2006 18:43:28 -0000 Received: (qmail 6190 invoked by uid 48); 5 Dec 2006 18:43:12 -0000 Date: Tue, 05 Dec 2006 18:43:00 -0000 Subject: [Bug c/30075] New: Missed optimizations with -fwhole-program -combine X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ajax at redhat dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-12/txt/msg00410.txt.bz2 --- 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