The -f(no-)inline-functions option does not work.  Its documented
effect is controlled by -f(no-)inline, both in gcc and g++.
(Don't ask me how that jibes with Bug #27881:-)

The doc says -finline-functions is only invoked by -O3.  I suggest
you preserve -O's current functionality: Move -finline-functions
from -O3 to -O and document that (under -fno-inline-functions).


The two first compile commands below work with gcc-3.4.4, but the
third does not:
  -fno-inline -finline-functions
does not inline foo().

That's possibly a doc bug:  (gcc)Optimize Options says
 `-fno-inline'
     Don't pay attention to the `inline' keyword.  Normally this option
     is used to keep the compiler from expanding any functions inline.
     (...)
One of these sentences is wrong.  Does -fno-inline only mean "ignore
the inline keyword", or does it mean "inline nothing, regardless of
other inlining options or keywords/attributes", or something else?


Doc bugs in Info node (gcc)Inline:

  "(If you are writing a header file to be included in ISO C programs,
  write `__inline__' instead of `inline'...")
Should now be "ISO C90" programs.

  "Some calls cannot be integrated for various reasons (in particular,
  calls that precede the function's definition cannot be integrated,..."
Except with -funit-at-a-time.  Which is also turned on by -O even though
it's documented as an -O2 option.


$ cat bug.c
static int foo(void)    { return 9; }
int bar(void)           { return foo(); }

$ gcc -O -fno-inline-functions -S bug.c -o-
        .file   "bug.c"
        .text
.globl bar
        .type   bar, @function
bar:
        pushl   %ebp
        movl    %esp, %ebp
        movl    $9, %eax
        popl    %ebp
        ret
        .size   bar, .-bar
        .ident  "GCC: (GNU) 4.1.1"
        .section        .note.GNU-stack,"",@progbits

$ gcc -O -fno-inline -S bug.c -o-
        .file   "bug.c"
        .text
        .type   foo, @function
foo:
        pushl   %ebp
        movl    %esp, %ebp
        movl    $9, %eax
        popl    %ebp
        ret
        .size   foo, .-foo
.globl bar
        .type   bar, @function
bar:
        pushl   %ebp
        movl    %esp, %ebp
        call    foo
        popl    %ebp
        ret
        .size   bar, .-bar
        .ident  "GCC: (GNU) 4.1.1"
        .section        .note.GNU-stack,"",@progbits

$ gcc -O -fno-inline -finline-functions -S bug.c -o-
<same output as from -O -fno-inline>


-- 
           Summary: -fno-inline-functions does not work, and doc bugs
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: h dot b dot furuseth at usit dot uio dot no
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to