Fixed a bug with local character arrays initialized with a string

This commit is contained in:
ceriel 1995-11-15 09:42:25 +00:00
parent 2985469116
commit c97f79454d
2 changed files with 6 additions and 3 deletions

View file

@ -37,6 +37,7 @@
#include "atw.h" #include "atw.h"
#include "assert.h" #include "assert.h"
#include "LLlex.h" #include "LLlex.h"
#include "align.h"
#ifdef LINT #ifdef LINT
#include "l_lint.h" #include "l_lint.h"
#endif /* LINT */ #endif /* LINT */
@ -559,7 +560,7 @@ loc_init(expr, id)
C_df_dlb((label)df->df_address); C_df_dlb((label)df->df_address);
} else { } else {
C_lae_dlb((label)df->df_address, (arith)0); C_lae_dlb((label)df->df_address, (arith)0);
load_block(tp->tp_size, 1); load_block(tp->tp_size, word_align);
if (unknownsize) { if (unknownsize) {
/* tmpoffset += tp->tp_size; */ /* tmpoffset += tp->tp_size; */
unknownsize = 0; unknownsize = 0;
@ -570,7 +571,7 @@ loc_init(expr, id)
, df->df_sc); , df->df_sc);
} }
C_lal(tmpoffset); C_lal(tmpoffset);
store_block(tp->tp_size, 1); store_block(tp->tp_size, tmpoffset % word_align ? 1 : word_align);
df->df_address = tmpoffset; df->df_address = tmpoffset;
tmpoffset = 0; tmpoffset = 0;
} }

View file

@ -235,11 +235,13 @@ declare_idf(ds, dc, lvl)
idf->id_text); idf->id_text);
/** type = idf->id_def->df_type = int_type; **/ /** type = idf->id_def->df_type = int_type; **/
} }
newdef->df_address = if (type->tp_size != (arith) -1) {
newdef->df_address =
NewLocal(type->tp_size, NewLocal(type->tp_size,
type->tp_align, type->tp_align,
regtype(type), regtype(type),
sc); sc);
}
break; break;
case STATIC: case STATIC:
newdef->df_address = (arith) data_label(); newdef->df_address = (arith) data_label();