Skip to content

Instantly share code, notes, and snippets.

@aykevl
Created February 14, 2018 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aykevl/ecdb91a6ade834879849dde160fa36fc to your computer and use it in GitHub Desktop.
Save aykevl/ecdb91a6ade834879849dde160fa36fc to your computer and use it in GitHub Desktop.
#include <stdio.h>
__attribute__((used))
int bar() {
printf("bar\n");
return 42;
}
__attribute__((noinline,naked))
int foo() {
asm("b bar\n");
// The following can be uncommented, resulting in invalid code.
//__builtin_unreachable();
}
int main() {
int n = foo();
printf("the number is: %d\n", n);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment