From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23824 invoked by alias); 28 Jun 2006 20:17:33 -0000 Received: (qmail 23809 invoked by uid 22791); 28 Jun 2006 20:17:32 -0000 X-Spam-Check-By: sourceware.org Received: from dessent.net (HELO dessent.net) (69.60.119.225) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 28 Jun 2006 20:17:29 +0000 Received: from localhost ([127.0.0.1] helo=dessent.net) by dessent.net with esmtp (Exim 4.61) (envelope-from ) id 1FvgTX-0006Ax-8Z for gcc-help@gcc.gnu.org; Wed, 28 Jun 2006 20:17:27 +0000 Message-ID: <44A2E3D6.F0A78450@dessent.net> Date: Wed, 28 Jun 2006 20:17:00 -0000 From: Brian Dessent Reply-To: gcc-help@gcc.gnu.org X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: Re: Symbols which were not used, still in binary References: <44A2DF65.8010704@web.de> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-06/txt/msg00265.txt.bz2 Steve Kreyer wrote: > I have compiled the follwing code with the command ''gcc file.c'' > > ... > > Neither is it used in this piece of code, nor is it compiled into an > object file, > so in my opinion it should be optimized away by gcc. > So perhaps anybody can tell me whats wrong with my thought... First of all, if you just type "gcc file.c" then you have not enabled any optimization at all. You have to supply -O2 (or -Os, -O1, etc.) if you want the compiler to perform optimization, as the default is -O0. That aside, the function won't be eliminated until it's declared "static", as some other module could still call it. Brian