diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2009-03-29 09:47:11 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2009-03-29 09:47:11 +0000 |
commit | a5f03d96eee482cd84861fc8cefff9eb451c0cad (patch) | |
tree | cbc66cbc183a7c5ef2c044ed9ed04b8011df9cd4 /cil/doc/examples/ex24.txt | |
parent | a9621943087a5578c995d88b06f87c5158eb5d00 (diff) | |
download | compcert-a5f03d96eee482cd84861fc8cefff9eb451c0cad.tar.gz compcert-a5f03d96eee482cd84861fc8cefff9eb451c0cad.zip |
Cleaned up configure script.
Distribution of CIL as an expanded source tree with changes applied
(instead of original .tar.gz + patches to be applied at config time).
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1020 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cil/doc/examples/ex24.txt')
-rw-r--r-- | cil/doc/examples/ex24.txt | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/cil/doc/examples/ex24.txt b/cil/doc/examples/ex24.txt new file mode 100644 index 00000000..587ce674 --- /dev/null +++ b/cil/doc/examples/ex24.txt @@ -0,0 +1,59 @@ +/* Generated by CIL v. 1.3.5 */ +/* print_CIL_Input is true */ + +extern void * stackguard_get_ra(); +extern void stackguard_set_ra(void *new_ra); +/* You must provide an implementation for functions that get and set the + * return address. Such code is unfortunately architecture specific. + */ +struct stackguard_stack { + void * data; + struct stackguard_stack * next; +} * stackguard_stack; + +void stackguard_push(void *ra) { + void * old = stackguard_stack; + stackguard_stack = (struct stackguard_stack *) + malloc(sizeof(stackguard_stack)); + stackguard_stack->data = ra; + stackguard_stack->next = old; +} + +void * stackguard_pop() { + void * ret = stackguard_stack->data; + void * next = stackguard_stack->next; + free(stackguard_stack); + stackguard_stack->next = next; + return ret; +} +#line 3 "cilcode.tmp/ex24.c" +extern int ( /* missing proto */ scanf)() ; +#line 1 "cilcode.tmp/ex24.c" +int dangerous(void) +{ char array[10] ; + void *return_address ; + + { + return_address = (void *)stackguard_get_ra(); + stackguard_push(return_address); +#line 3 + scanf("%s", array); + { + return_address = (void *)stackguard_pop(); + stackguard_set_ra(return_address); +#line 4 + return (0); + } +} +} +#line 6 "cilcode.tmp/ex24.c" +int main(void) +{ int tmp ; + + { +#line 7 + tmp = dangerous(); +#line 7 + return (tmp); +} +} |