This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/49666] New: passing nested function to inline function causes a trampoline call
- From: "kevin.waugh at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 7 Jul 2011 03:46:12 +0000
- Subject: [Bug other/49666] New: passing nested function to inline function causes a trampoline call
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49666
Summary: passing nested function to inline function causes a
trampoline call
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: other
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: kevin.waugh@gmail.com
#include <stdio.h>
static inline int identity(int (*f)()) {
return f();
}
int n = 0;
int f() {
return n;
}
int main() {
int m = 0;
int g() {
return m;
}
printf("%d\n", identity(f)); /* inlines all the way */
printf("%d\n", identity(g)); /* calls g through trampoline */
printf("%d\n", g()); /* inline's g */
}