view test_para2.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>

__code cs_end(int a){
  printf("cs_exit : a=%d.\n", a);
  exit(a);
}

__code cs0(int a, int b, int c, int d);

__code cs_goto(int a, int b, int c, int d){
  printf("cs_goto : a=%d, b=%d, c=%d, d=%d.\n", a, b, c, d);
  goto cs0(b, c, d, a);
}

__code cs0(int a, int b, int c, int d){
  printf("cs_cs0  : a=%d, b=%d, c=%d, d=%d.\n", a, b, c, d);
  goto cs_end( (int)(20*a + 30*b + 40*c + 50*d) );
}


void function(double a, float b, int c){
  goto cs_goto(10, 20, 30, 40);
}

int main(int argc, char **argv){
  function(10.01, 20.02, 30);
  return 0;
}