view test_tree.c @ 17:a4f44624a253

asm longjmp (can return correct address but return value is wrong)
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Sun, 24 Jan 2016 06:01:43 +0900
parents 35d6eabeadb0
children 586096c45873
line wrap: on
line source

#include<stdio.h>
#include<stdlib.h>
double test(char, char, int, double);
__code cs(int , double , char );
void testvoid(double a);
int testint(double a);
__code test_goto1(int a, int b, double c);

__code cs(int a, double b, char c){
  printf("__code cs was called.\n");
  printf("a = %d, b = %lf, c = %d\n", a, b, c);
  exit(0);
}
__code cs1(int a, double b, char c, int d){
  printf("__code cs1 was called.\n");
  printf("a = %d, b = %lf, c = %d, d = %d\n", a, b, c, d);
  exit(0);
}

int main(int argc, char **argv){
  double t;

  t = test('a', 'b', 10, 2.5);
  printf("t = %lf\n", t);
  testvoid(2.22);
  testint(2.22);

  printf("test_goto\n");
  goto test_goto1(10, 20, 30.3);
  return 0;
}
void test0(){
  exit(0);
}

void testvoid(double a){
  return ;
}
int testint(double a){
  int b;
  b = (a*100-a) +2;
  return 1;
}

double test(char c, char l, int a, double d){
  return (double)a*d+c+l;
}

void test_goto(int a, int b, double c){
  goto cs(2, 10.2, 3);
}
__code test_goto1(int a, int b, double c){
  goto cs1(2, 10.2, 3, 4);
}