# HG changeset patch # User Shinji KONO # Date 1290805965 -32400 # Node ID 425768eb5e9e96062545183a73d1af383843c7d3 # Parent 2e6a95731a5eb154f598afe89ed40a81a98eb162 code segment fix for non parse mode diff -r 2e6a95731a5e -r 425768eb5e9e mc-code-ia32.c --- a/mc-code-ia32.c Fri Nov 26 06:37:41 2010 +0900 +++ b/mc-code-ia32.c Sat Nov 27 06:12:45 2010 +0900 @@ -997,6 +997,8 @@ /* process in reverse order */ n = ncadddr(args); type = n->ty; + int sz = size(type); + offset = code_arg_alignment(offset,n,type,sz,is_code0); // n->dsp = offset; // printf("### %s %d %d\n",n->nm,n->dsp,n->ty); if (scalar(type)) { @@ -1007,7 +1009,6 @@ reg_var++; caddr(args)=SIZE_OF_INT; /* why we need this? */ } - offset+=SIZE_OF_INT; } else if (type==FLOAT||type==DOUBLE) { if ((reg = get_input_dregister_var(freg_var,n,is_code0,1))) { n->sc = DREGISTER; @@ -1016,9 +1017,7 @@ freg_var++; caddr(args)=size(type); /* why we need this? */ } - offset+=size(type); - } else - offset+=size(type); + } args = cadr(args); } } diff -r 2e6a95731a5e -r 425768eb5e9e mc-code-powerpc.c --- a/mc-code-powerpc.c Fri Nov 26 06:37:41 2010 +0900 +++ b/mc-code-powerpc.c Sat Nov 27 06:12:45 2010 +0900 @@ -838,6 +838,7 @@ int is_code0 = is_code(fnptr); int dots; arg_offset_v = 0; + int offset = 0; function_type(fnptr->ty,&dots); @@ -854,6 +855,8 @@ /* process in reverse order */ n = ncadddr(args); type = n->ty; + int sz = size(type); + offset = code_arg_alignment(offset,n,type,sz,is_code0); if (scalar(type)) { if ((reg = get_input_register_var(reg_var,n,is_code0))) { n->sc = REGISTER; @@ -2261,6 +2264,17 @@ int reg_offset = 0; int offset = 0; int reg_var = 0; + if (!parse_mode && dots) { + int stype = type; int smode = mode; + type = INT; + mode = LDECL; + stmode = 0; + // lsearch defines local name + NMTBL *n = def(lsearch("__my_va_list",0),0); + n->dsp = offset; + type = stype; mode = smode; + } + for(args = fnptr->dsp;args;args = cadr(args)) { n = ncadddr(args);