Mercurial > hg > CbC > CbC_examples
view test_para3.c @ 29:a94136a6edb2 default tip
fix for LLVM12
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 17 Jul 2021 14:38:29 +0900 |
parents | 51f8521bc5d1 |
children |
line wrap: on
line source
#include<stdio.h> #include<stdlib.h> struct abc { int a; double b; char c; double *d; }; struct def { int d; struct abc e; struct abc *f; }; void print_abc(struct abc a){ printf("\tstruct abc:\n"); printf("\ta=%d, b=%lf, c=%d, d=%p\n", a.a, a.b, a.c, a.d); } void print_def(struct def b){ printf("\tstruct def:\n"); printf("\td=%d, f=%p\n", b.d, b.f); print_abc(b.e); } __code cs_exit(int a){ printf("cs_exit : a=%d.\n", a); exit(a); } __code cs0(struct abc a, struct def b, int c){ printf("cs0 :\n"); printf("c=%d\n", c); print_abc(a); print_def(b); goto cs_exit( c*a.a+b.e.c ); } __code cs_goto(int c, struct abc a, struct def b){ printf("cs_goto :\n"); printf("c=%d\n", c); print_abc(a); print_def(b); goto cs0(a, b, c); } int function(){ struct abc A; struct def B; A.a = 10, A.b = 20.02, A.c = '\0', A.d = (void*)0xad; B.d = 30, B.f = (void*)0xbf; B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = (void*)0xed; printf("function :\n"); print_abc(A); print_def(B); //printf("20*%d + 30*%d + 40*%d + 50*%d =\n", a, b, c, d); goto cs_goto(100, A, B); return 0; } int main(int argc, char **argv){ struct abc A; struct def B; //int a=10, b=20, c=30, d=40, e=50, f=60, g=70; A.a = 10, A.b = 20.02, A.c = '\0', A.d = (void*)0xad; B.d = 30, B.f = (void*)0xbf; B.e.a = 50, B.e.b = 60.06, B.e.c = '\1', B.e.d = (void*)0xed; /* printf("main :\n"); print_abc(A); print_def(B); //printf("20*%d + 30*%d + 40*%d + 50*%d =\n", a, b, c, d); goto cs_goto(100, A, B); */ function(); return 0; }