Skip to content

Instantly share code, notes, and snippets.

@manuel
Created July 18, 2009 19:28
Show Gist options
  • Select an option

  • Save manuel/149671 to your computer and use it in GitHub Desktop.

Select an option

Save manuel/149671 to your computer and use it in GitHub Desktop.
// lambda trampoline. crashes with gcc -O2 and -O3.
#include <stddef.h>
#include <stdio.h>
void
foo(char *s)
{
__asm("foo_label:");
printf("%s\n", s);
}
void
foo_trampoline(char *s)
{
__asm("jmp foo_label");
}
int
main()
{
foo_trampoline("hey");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment