From: ceriel Date: Tue, 19 Feb 1991 12:41:27 +0000 (+0000) Subject: prevent sign-extension in unpack when needed X-Git-Tag: release-5-5~1249 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=07092a19ca52b2a78e07491f8c4763cd40b75fc8;p=ack.git prevent sign-extension in unpack when needed --- diff --git a/lang/pc/comp/code.c b/lang/pc/comp/code.c index fcb61cc54..2f2c84ae0 100644 --- a/lang/pc/comp/code.c +++ b/lang/pc/comp/code.c @@ -1023,6 +1023,7 @@ CodeStd(nd) case R_PACK: { label lba = tp->arr_ardescr; + CodeDAddress(left); arg = arg->nd_right; left = arg->nd_left; @@ -1043,6 +1044,12 @@ CodeStd(nd) */ label lba, lbz = tp->arr_ardescr; + tp = tp->arr_elem; + if (tp->tp_fund == T_SUBRANGE && + tp->sub_lb >= 0) { + C_loc((arith) 1); + } + else C_loc((arith) 0); CodeDAddress(left); arg = arg->nd_right; left = arg->nd_left; @@ -1054,7 +1061,7 @@ CodeStd(nd) C_lae_dlb(lbz, (arith) 0); C_lae_dlb(lba, (arith) 0); C_cal("_unp"); - C_asp(4 * pointer_size + word_size); + C_asp(4 * pointer_size + 2 * word_size); break; }