From: ceriel Date: Wed, 15 Nov 1995 09:42:25 +0000 (+0000) Subject: Fixed a bug with local character arrays initialized with a string X-Git-Tag: release-5-5~74 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=c97f79454d8652516a56aa1eea34a4c946490507;p=ack.git Fixed a bug with local character arrays initialized with a string --- diff --git a/lang/cem/cemcom.ansi/code.c b/lang/cem/cemcom.ansi/code.c index 2f2f0f452..e16ae472c 100644 --- a/lang/cem/cemcom.ansi/code.c +++ b/lang/cem/cemcom.ansi/code.c @@ -37,6 +37,7 @@ #include "atw.h" #include "assert.h" #include "LLlex.h" +#include "align.h" #ifdef LINT #include "l_lint.h" #endif /* LINT */ @@ -559,7 +560,7 @@ loc_init(expr, id) C_df_dlb((label)df->df_address); } else { C_lae_dlb((label)df->df_address, (arith)0); - load_block(tp->tp_size, 1); + load_block(tp->tp_size, word_align); if (unknownsize) { /* tmpoffset += tp->tp_size; */ unknownsize = 0; @@ -570,7 +571,7 @@ loc_init(expr, id) , df->df_sc); } C_lal(tmpoffset); - store_block(tp->tp_size, 1); + store_block(tp->tp_size, tmpoffset % word_align ? 1 : word_align); df->df_address = tmpoffset; tmpoffset = 0; } diff --git a/lang/cem/cemcom.ansi/idf.c b/lang/cem/cemcom.ansi/idf.c index 1e6fa244e..a6d4548e6 100644 --- a/lang/cem/cemcom.ansi/idf.c +++ b/lang/cem/cemcom.ansi/idf.c @@ -235,11 +235,13 @@ declare_idf(ds, dc, lvl) idf->id_text); /** type = idf->id_def->df_type = int_type; **/ } - newdef->df_address = + if (type->tp_size != (arith) -1) { + newdef->df_address = NewLocal(type->tp_size, type->tp_align, regtype(type), sc); + } break; case STATIC: newdef->df_address = (arith) data_label();