c/191: String literals from unused inline functions are still generated

greyham@research.canon.com.au greyham@research.canon.com.au
Tue May 2 19:36:00 GMT 2000


>Number:         191
>Category:       c
>Synopsis:       String literals from unused inline functions are still generated
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Tue May 02 19:36:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Graham Stoney
>Release:        2.95.2
>Organization:
>Environment:
Red Hat Linux 6.2
>Description:
Continuing my quest for the elimination of unused strings, I've noticed that
when the out-of-line copy of an inlined function is optimised away, the strings
that it references are not. As a result, unused static inline functions (such
as those you might encounter in a .h file) still generate gumpf in .rodata.

Here's a simple example:

    static inline int call(char *str)
    {
        printf("this is a string");
    }

    int main()
    {
        return 0;
    }

Notice that the string remains:

        .file   "inline2.c"
        .version        "01.01"
gcc2_compiled.:
.section        .rodata
.LC0:
        .string "this is a string"
.text
        .align 4
.globl main
        .type    main,@function
main:
        pushl %ebp
        movl %esp,%ebp
        xorl %eax,%eax
        movl %ebp,%esp
        popl %ebp
        ret
.Lfe1:
        .size    main,.Lfe1-main
        .ident  "GCC: (GNU) 2.95.2 19991024 (release)"
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-prs mailing list