This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
optimization/7515: invalid inlining
- From: drepper at redhat dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 7 Aug 2002 03:25:54 -0000
- Subject: optimization/7515: invalid inlining
- Reply-to: drepper at redhat dot com
>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=