use C_con_cst instead of C_con_icon when possible;
fix sizeof(string) to return the size of the string instead of the size of a pointer
This commit is contained in:
parent
8e09304da7
commit
f4caec88e8
3 changed files with 7 additions and 2 deletions
|
@ -17,7 +17,7 @@ PRTLIB = $(EMHOME)/modules/lib/libprint.a
|
|||
EMMESLIB = $(EMHOME)/modules/lib/libem_mes.a
|
||||
EMMESOLIB = $(EMHOME)/modules/lib/libem_mesO.a
|
||||
EMMESCELIB = $(EMHOME)/modules/lib/libem_mesCE.a
|
||||
MACH = vax4
|
||||
MACH = sun3
|
||||
EMCELIB = $(EMHOME)/lib/$(MACH)/ce.a \
|
||||
$(EMHOME)/lib/$(MACH)/back.a \
|
||||
$(EMHOME)/modules/lib/libobject.a $(EMHOME)/lib/em_data.a
|
||||
|
|
|
@ -153,7 +153,10 @@ ch7mon(oper, expp)
|
|||
)
|
||||
warning("sizeof formal array %s is sizeof pointer!",
|
||||
(*expp)->VL_IDF->id_text);
|
||||
expr = intexpr(size_of_type((*expp)->ex_type, "object"), INT);
|
||||
expr = intexpr((*expp)->ex_type == string_type ?
|
||||
(arith)((*expp)->SG_LEN) :
|
||||
size_of_type((*expp)->ex_type, "object"),
|
||||
INT);
|
||||
expr->ex_flags |= EX_SIZEOF;
|
||||
free_expression(*expp);
|
||||
*expp = expr;
|
||||
|
|
|
@ -674,6 +674,8 @@ con_int(ex)
|
|||
ASSERT(is_cp_cst(ex));
|
||||
if (tp->tp_unsigned)
|
||||
C_con_ucon(long2str((long)ex->VL_VALUE, -10), tp->tp_size);
|
||||
else if (tp->tp_size == word_size)
|
||||
C_con_cst(ex->VL_VALUE);
|
||||
else
|
||||
C_con_icon(long2str((long)ex->VL_VALUE, 10), tp->tp_size);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue