From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8296 invoked by alias); 7 Aug 2002 03:26:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 8268 invoked by uid 71); 7 Aug 2002 03:26:01 -0000 Resent-Date: 7 Aug 2002 03:26:01 -0000 Resent-Message-ID: <20020807032601.8267.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, drepper@redhat.com Received: (qmail 8224 invoked by uid 61); 7 Aug 2002 03:25:54 -0000 Message-Id: <20020807032554.8223.qmail@sources.redhat.com> Date: Tue, 06 Aug 2002 20:26:00 -0000 From: drepper@redhat.com Reply-To: drepper@redhat.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: optimization/7515: invalid inlining X-SW-Source: 2002-08/txt/msg00120.txt.bz2 List-Id: >Number: 7515 >Category: optimization >Synopsis: invalid inlining >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Aug 06 20:26:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Ulrich Drepper >Release: at least 2.96 and later >Organization: >Environment: x86 Linux, but probably all others >Description: When -O3 is used gcc performs invalid inlining optimizations. Functions, which are not declared static or have a visibility != default must not be inlined. At least when generating code for ELF binaries. The semantic changes since 'foo' will not be looked up using the ELF symbol resolution rules which would allow interposition. >How-To-Repeat: Compile the attached code with -O3. The result is that 'foo' gets inlined. >Fix: Only inline if the function is static, has visibility != default, or possibly if a new function attribute or command line option is used. >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="o3.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="o3.c" aW50CmZvbyAoaW50IGEpCnsKICAgIHJldHVybiBhOwp9CgppbnQKYmFyIChpbnQgYSkKewogICAg cmV0dXJuIGZvbyAoYSkgPT0gMTsKfQo=