From: ceriel Date: Tue, 19 Apr 1988 14:40:27 +0000 (+0000) Subject: fixed a small problem with the 'symmetric' option; also fixed a X-Git-Tag: release-5-5~3382 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=9d3f9ea496988832c34b76766fcec7d67ae1a86c;p=ack.git fixed a small problem with the 'symmetric' option; also fixed a problem with Hex numbers --- diff --git a/lang/m2/comp/LLlex.c b/lang/m2/comp/LLlex.c index fc5e571de..ca1b208a2 100644 --- a/lang/m2/comp/LLlex.c +++ b/lang/m2/comp/LLlex.c @@ -434,7 +434,7 @@ again: else { state = End; if (ch == 'H') base = 16; - UnloadChar(ch); + else UnloadChar(ch); } break; diff --git a/lang/m2/comp/chk_expr.c b/lang/m2/comp/chk_expr.c index c0f6464d7..5684ffd3a 100644 --- a/lang/m2/comp/chk_expr.c +++ b/lang/m2/comp/chk_expr.c @@ -101,14 +101,15 @@ MkCoercion(pnd, tp) wmess = "conversion"; } break; - case T_INTEGER: { - long i = min_int[(int)(tp->tp_size)]; - long j = nd->nd_INT & i; - - if (j != 0 && (nd_tp->tp_fund != T_INTEGER || j != i)) { + case T_INTEGER: + if (! chk_bounds(nd->nd_INT, + max_int[(int)(tp->tp_size)], + nd_tp->tp_fund) || + ! chk_bounds(min_int[(int)(tp->tp_size)], + nd->nd_INT, + T_INTEGER)) { wmess = "conversion"; } - } break; } if (wmess) { @@ -818,7 +819,6 @@ ChkBinOper(expp) { /* Check a binary operation. */ - register t_node *left = expp->nd_left, *right = expp->nd_right; register t_type *tpl, *tpr; t_type *result_type; int allowed; @@ -826,19 +826,19 @@ ChkBinOper(expp) /* First, check BOTH operands */ - retval = ChkExpression(left) & ChkExpression(right); + retval = ChkExpression(expp->nd_left) & ChkExpression(expp->nd_right); - tpl = BaseType(left->nd_type); - tpr = BaseType(right->nd_type); + tpl = BaseType(expp->nd_left->nd_type); + tpr = BaseType(expp->nd_right->nd_type); if (tpl == intorcard_type) { if (tpr == int_type || tpr == card_type) { - left->nd_type = tpl = tpr; + expp->nd_left->nd_type = tpl = tpr; } } if (tpr == intorcard_type) { if (tpl == int_type || tpl == card_type) { - right->nd_type = tpr = tpl; + expp->nd_right->nd_type = tpr = tpl; } } @@ -863,12 +863,11 @@ ChkBinOper(expp) I don't know! Should we be allowed to check if a INTEGER is a member of a BITSET??? */ - node_error(left, "type incompatibility in IN"); + node_error(expp->nd_left, "type incompatibility in IN"); return 0; } MkCoercion(&(expp->nd_left), word_type); - left = expp->nd_left; - if (left->nd_class == Value && right->nd_class == Set) { + if (expp->nd_left->nd_class == Value && expp->nd_right->nd_class == Set) { cstset(expp); } return retval; @@ -901,12 +900,14 @@ ChkBinOper(expp) } if (tpl->tp_fund == T_SET) { - if (left->nd_class == Set && right->nd_class == Set) { + if (expp->nd_left->nd_class == Set && + expp->nd_right->nd_class == Set) { cstset(expp); } } else if ( tpl->tp_fund != T_REAL && - left->nd_class == Value && right->nd_class == Value) { + expp->nd_left->nd_class == Value && + expp->nd_right->nd_class == Value) { if (expp->nd_left->nd_type->tp_fund == T_INTEGER) { cstibin(expp); } diff --git a/lang/m2/comp/error.c b/lang/m2/comp/error.c index 068f18fb1..6312b04fa 100644 --- a/lang/m2/comp/error.c +++ b/lang/m2/comp/error.c @@ -208,7 +208,7 @@ _error(class, node, ap) switch (class) { case WARNING: case LEXWARNING: - if (! warn_class & warning_classes) return; + if (! (warn_class & warning_classes)) return; switch(warn_class) { #ifndef STRICT_3RD_ED case W_OLDFASHIONED: