Mercurial > hg > CbC > old > device
changeset 899:62498a76e716
static initialization and local_nptr fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Apr 2014 09:57:16 +0900 |
parents | c073495301ae |
children | 8d225b0c3cf3 |
files | mc-codegen.c mc-parse.c |
diffstat | 2 files changed, 7 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-codegen.c Tue Apr 08 09:17:43 2014 +0900 +++ b/mc-codegen.c Tue Apr 08 09:57:16 2014 +0900 @@ -170,7 +170,7 @@ e2 = cadr(e1); switch (car(e1)){ - case GVAR: + case GVAR: case STATIC: code_gvar(e1,USE_CREG); return ADDRESS; case RGVAR: @@ -4017,12 +4017,9 @@ emit_data(e,t,n); break; case STADECL: - if (!local_nptr) { - if (!is_const(e)) error(INERR); - else emit_data(e,t,n); - break; - } - n = local_nptr; + if (!is_const(e)) error(INERR); + else emit_data(e,t,n); + break; case LDECL: case STAT: // inline case if (t==EMPTY) {
--- a/mc-parse.c Tue Apr 08 09:17:43 2014 +0900 +++ b/mc-parse.c Tue Apr 08 09:57:16 2014 +0900 @@ -51,7 +51,7 @@ extern double strtod(const char *nptr, char **endptr); #endif -int parse_mode = 0; // generate parse tree for all code +int parse_mode = 1; // generate parse tree for all code static int HEAP_REPORT = 0; static int lfree_type_limit; // debugging purpose @@ -986,7 +986,7 @@ error(DCERR); } conv->return_type_(type,n,1); - def(n,ctmode); + n = def(n,ctmode); v = list3n(n->sc,n->dsp,n); if (sym==ASS && n!=&null_nptr) { conv->op_(sym); @@ -1685,7 +1685,7 @@ mode=STADECL; nptr0=new_static_name("__lstruct",'_'); - def(nptr0,0); + nptr = def(nptr0,0); mode=smode; v0 = list3n(GVAR,0,nptr0); decl_data_field(type,v0,offset);