Observing it at least on stage 1 compiler, and exactly the same way as
in 3.3.2.

If inline function, later called a functional, is passed a function
argument that is constant and inline, and said argument is called in
the functional body, and when inline expansions are on, compiler
expand inline only said functional, but not function argument calls in
said expansion.  Instead, it handles these calls just like those of
non- inline function, that is, outputs uninlined function body and
call instruction of that body, with all call overhead.

If argument is a nested function, 4.0.3 behaves a bit better than
3.3.2.  It does not output full trampoline code unnecessarily.

Priority?  How should I know?  Depends on projects using the compiler.

Environment:
System: Linux way2go 2.6.3-27mdk #1 Tue May 31 21:48:42 MDT 2005 i686 unknown
unknown GNU/Linux
Architecture: i686

host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../share/src/gcc-4.0.3/configure --enable-languages=c

How-To-Repeat:
Compile with `-O99'.  `do_it_cb' code is output as a separate funtion,
and code output for `do_it_with_g_set_v0' calls `do_it_cb', not
`do_it'.

extern int g_set_v0 (void);
extern void g_restore_v (int);
extern void do_it (void);

static inline
with_g_set_v0 (void (f) (void))
{
  int v = g_set_v0 ();
  f ();
  g_restore_v (v);
}

static inline void
do_it_cb (void)
{
  do_it ();
}

void
do_it_with_g_set_v0 (void)
{
  with_g_set_v0 (do_it_cb);
}


-- 
           Summary: does not inline constant funargs
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gin at mo dot msk dot ru
 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=28470

Reply via email to