1
2/* This is a test program from Lee Kindness which used to fail on V
3   because gcc implements the nested function mumbo jumbo using self
4   modifying code on the stack, at least on x86 and amd64.  It now
5   works transparently because by default V now generates
6   self-checking translations for translations taken from stack-like
7   segments.
8*/
9
10#include <stdio.h>
11
12 static void call_func(void (*sel)(void))
13 {
14    sel();
15 }
16
17 void test1()
18 {
19    void test1_inner()
20    {
21       printf( "Inside test1\n" );
22    }
23    call_func( test1_inner );
24 }
25
26 void test2()
27 {
28    void test2_inner()
29    {
30       printf( "Inside test2\n" );
31    }
32    call_func( test2_inner );
33 }
34
35 int main(int argc, char** argv)
36 {
37    test1();
38    test2();
39    return( 0 );
40 }
41
42