[Bug c/12937] New: Function not inlined

hartmut dot schirmer at arcor dot de gcc-bugzilla@gcc.gnu.org
Fri Nov 7 07:21:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12937

           Summary: Function not inlined
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hartmut dot schirmer at arcor dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-cygwin
GCC target triplet: sh-elf

The following example

-----------------------------
static const char msbit4[16] =  { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 
3 };

static __inline__ int test1(unsigned int x)
{
    int res = 0;

    if ( x != ((unsigned int)(unsigned short)x) )
    {
        res += 16;
        x >>= 16;
    }
    if ( x != ((unsigned int)(unsigned char)x) )
    {
        res += 8;
        x >>= 8;
    }
    if ( x & 0xf0 )
    {
        res += 4;
        x >>= 4;
    }
    return res + msbit4[x];
}

int foo(unsigned x)
{
    return 2*test1(x);
}
-----------------

! GNU C version 2.95.2 19991024 (release-2) (sh-hitachi-coff)
        compiled by GNU C version 2.95.2 19991024 (release-2).

inlined test1() but 

! GNU C version 3.3.2 20031006 (prerelease) (sh-elf)
!	compiled by GNU C version 3.3.1 (cygming special).

fails to do:

test.c: In function `foo':
test.c:4: warning: inlining failed in call to `test1'
test.c:27: warning: called from here


gcc 2.95.2 options from assembler output:
! GNU C version 2.95.2 19991024 (release-2) (sh-hitachi-coff) compiled by GNU C 
version 2.95.2 19991024 (release-2).
! options passed:  -mrelax -m1 -Os -Winline -Wno-long-long -Wall -Wmain
! -Wmissing-declarations -Wpointer-arith -Wno-trigraphs -Wundef -Wunused
! -Wwrite-strings -Wuninitialized -Wunknown-pragmas -Wcomment
! -Wchar-subscripts -Wformat -Wimplicit -Wimplicit-function-declaration
! -Wimplicit-int -Wmissing-braces -Wmissing-prototypes -Wmultichar
! -Wparentheses -Wstrict-prototypes -Wswitch -std=c9x -fverbose-asm
! -fno-keep-static-consts -fno-strict-aliasing -fno-gcse -fno-exceptions
! -fomit-frame-pointer
! options enabled:  -fdefer-pop -fomit-frame-pointer -fcse-follow-jumps
! -fcse-skip-blocks -fexpensive-optimizations -fthread-jumps
! -fstrength-reduce -fpeephole -fforce-mem -ffunction-cse -finline
! -fcaller-saves -freg-struct-return -fdelayed-branch
! -frerun-cse-after-loop -frerun-loop-opt -fschedule-insns2
! -fsched-interblock -fsched-spec -fsjlj-exceptions -fcommon -fverbose-asm
! -fgnu-linker -fregmove -foptimize-register-move -fgcc-struct
! -fargument-alias -fident -m1 -mrelax -mspace

gcc 3.3.2 options:
! GNU C version 3.3.2 20031006 (prerelease) (sh-elf)
!	compiled by GNU C version 3.3.1 (cygming special).
! GGC heuristics: --param ggc-min-expand=82 --param ggc-min-heapsize=98220
! options passed:  -fpreprocessed -mrelax -m1 -auxbase-strip -Os -Winline
! -Wno-long-long -Wall -Wno-trigraphs -Wcomments -Wundef -Wimport
! -Wstrict-aliasing -Wdeprecated-declarations -Wpacked -Wuninitialized
! -Wswitch -Wunused-value -Wunused-variable -Wunused-label
! -Wunused-function -Wchar-subscripts -Wmissing-braces -Wmissing-prototypes
! -Wmultichar -Wparentheses -Wpointer-arith -Wreturn-type
! -Wstrict-prototypes -Wunknown-pragmas -Wwrite-strings -Wimplicit-int
! -Wmain -Wmissing-declarations -Wnested-externs -Wsequence-point
! -Wimplicit-function-declaration -std=c99 -fverbose-asm
! -fno-keep-static-consts -fno-strict-aliasing -fno-exceptions
! -fomit-frame-pointer -ffunction-sections -fdata-sections
! options enabled:  -fdefer-pop -fomit-frame-pointer
! -foptimize-sibling-calls -fcse-follow-jumps -fcse-skip-blocks
! -fexpensive-optimizations -fthread-jumps -fstrength-reduce -fpeephole
! -fforce-mem -ffunction-cse -fcaller-saves -freg-struct-return
! -fdelayed-branch -fgcse -fgcse-lm -fgcse-sm -floop-optimize
! -fcrossjumping -fif-conversion -fif-conversion2 -frerun-cse-after-loop
! -frerun-loop-opt -fdelete-null-pointer-checks -fschedule-insns2
! -fsched-interblock -fsched-spec -fbranch-count-reg -freorder-functions
! -fcprop-registers -fcommon -ffunction-sections -fdata-sections
! -fverbose-asm -fgnu-linker -fregmove -foptimize-register-move
! -fargument-alias -fmerge-constants -fzero-initialized-in-bss -fident
! -fpeephole2 -fguess-branch-probability -fmath-errno -ftrapping-math -m1
! -mrelax -mspace



More information about the Gcc-bugs mailing list