Bug#173513: Wishlist: Inline constant function pointers
Package: gcc-3.2
Version: 1:3.2.1-0pre3
Severity: wishlist
Currently GCC will not inline a call of a function pointer that is known
at compile time. For example, the following code will still result in
the instruction "call funk" when run with -finline-functions on i386:
#include <stdio.h>
static char* funk() {
return "Hello World.\n";
}
static void funky(char*(*func)()) {
printf("%s", func());
}
void main() {
funky(funk);
}
Although the call to funky is inlined, the call to funk is not, because
in the source code it appears as a call of a function pointer. But as a
consequence of funky being inlined, it would be possible to inline funk
as well.
-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux crafter 2.4.19 #1 Fri Sep 27 18:25:53 PDT 2002 i686
Locale: LANG=C, LC_CTYPE=C
Versions of packages gcc-3.2 depends on:
ii binutils 2.13.90.0.10-1 The GNU assembler, linker and bina
ii cpp-3.2 1:3.2.1-0pre3 The GNU C preprocessor.
ii gcc-3.2-base 1:3.2.1-0pre3 The GNU Compiler Collection (base
ii libc6 2.2.5-14.3 GNU C Library: Shared libraries an
ii libgcc1 1:3.2.1-0pre3 GCC support library.
Reply to: