From f4caec88e8a618d9efb54f454eba94d50d791c95 Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 12 Dec 1988 14:21:45 +0000 Subject: [PATCH] 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 --- lang/cem/cemcom/Makefile | 2 +- lang/cem/cemcom/ch7mon.c | 5 ++++- lang/cem/cemcom/ival.g | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lang/cem/cemcom/Makefile b/lang/cem/cemcom/Makefile index f2762b4cc..8cd000fa5 100644 --- a/lang/cem/cemcom/Makefile +++ b/lang/cem/cemcom/Makefile @@ -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 diff --git a/lang/cem/cemcom/ch7mon.c b/lang/cem/cemcom/ch7mon.c index dabefba71..a5a3ad17b 100644 --- a/lang/cem/cemcom/ch7mon.c +++ b/lang/cem/cemcom/ch7mon.c @@ -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; diff --git a/lang/cem/cemcom/ival.g b/lang/cem/cemcom/ival.g index 3af7f1488..3d78418a3 100644 --- a/lang/cem/cemcom/ival.g +++ b/lang/cem/cemcom/ival.g @@ -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); } -- 2.34.1