Mercurial > hg > CbC > CbC_examples
view test_func2code.c @ 25:6324b8df04f1
lj_as2: fix segmentation fault
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 31 Jan 2016 21:44:55 +0900 |
parents | 35d6eabeadb0 |
children | 586096c45873 |
line wrap: on
line source
#include<stdio.h> #include<stdlib.h> #define DEBUG 1 #ifdef DEBUG #define log(f, args...) \ fprintf(stderr, "in %s: "f, __FUNCTION__, ## args) #else #define log(f, args...) ; #endif __code exitter(int a) { exit(0); } __code cs0(int x, int y) { log("x = %d, y = %d.\n", x, y); log("will exit with code %d.\n", x*y); goto exitter(x*y); } void continuation(int a) { log("go code segment cs0\n"); goto cs0(a, a*20); log("Error: continuation reachs bad region.\n"); } int main(int argc, char **argv) { int a; if (argc>2) { a = atoi(argv[1]); } continuation(20); }