1 #include <stdio.h>
2 
3 
4 /*
5  * builtin frame address. This test is a bit silly. It only tests
6  * if the current stack frame's frame pointer is available, and if
7  * the local variable ``p'' is declared is SOME proximity to that
8  * address.
9  */
10 int
main()11 main() {
12 	char	*p = (char *)&p;
13 	char	*fp = __builtin_frame_address(0);
14 	int	ok = 0;
15 
16 	if (fp >= p && fp - 128 < p) {
17 		ok = 1;
18 	}
19 	if (fp <= p && fp + 128 > p) {
20 		ok = 1;
21 	}
22 	if (ok) {
23 		puts("OK");
24 	} else {
25 		puts("BUG");
26 	}
27 }
28 
29