RTL for function marked "static inline" is not generated at -O0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Any idea why even the RTL would not be generated for functions that
are marked "static inline" at -O0?

For a simple test case like this one:

static inline int foo(int a, int b);

int
bar(int p, short q)
{
  int a = p * q;
  int b = p/q;

  return foo(a, b);
}

static inline int
foo(int a, int b)
{
  return a - b;
}

The compiler doesn't generate the RTL for the function foo at -O0.
Since the function is not inlined at -O0, there is a call to foo() in
bar() and the function foo() does not exist in the assembly generated.

This apart, the following observations are made:

1) If the static keyword is removed, the test case works fine.
2) If the function definition of foo() is moved before the definition
of bar(), the test case works fine.
3) If the file is compiled at -O1 or -O2, the function gets inlined
and hence the test case again works fine.

Any suggestions on what might be happening?  I'm using gcc-4.1.2.
I've checked the flags_inline* variables and their values at runtime
seem to be in order.

Thanks and regards
Ayonam


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux