optimization/7515: invalid inlining
drepper@redhat.com
drepper@redhat.com
Tue Aug 6 20:26:00 GMT 2002
>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=
More information about the Gcc-bugs
mailing list