From: Abegail Jakop Date: Wed, 23 Sep 2015 14:14:53 +0000 (-0400) Subject: PR18455: add type mismatch checks in const_folder X-Git-Tag: release-2.9~48 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=61f7979238c4f36c3321d2831aff32dd438dee48;p=systemtap.git PR18455: add type mismatch checks in const_folder elaborate.cxx: in const_folder::visit_binary_expression() if one side is a literal number and the other is not pe_long or pe_unkown, produce a type mismatch --- diff --git a/elaborate.cxx b/elaborate.cxx index 9387ffd16..be82e8084 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -3731,6 +3731,15 @@ const_folder::visit_binary_expression (binary_expression* e) // we'll pass on type=pe_long inference to the expression if (other->type == pe_unknown) other->type = pe_long; + else if (other->type != pe_long) + { + // this mismatch was not caught in the initial type resolution pass, + // generate a mismatch (left doesn't match right) error + typeresolution_info ti(session); + ti.assert_resolvability = true; // need this to get it throw errors + ti.mismatch_complexity = 1; // also needed to throw errors + ti.mismatch(e); + } if (left) value = left->value; @@ -3759,6 +3768,15 @@ const_folder::visit_binary_expression (binary_expression* e) expression* other = left ? e->right : e->left; if (other->type == pe_unknown) other->type = pe_long; + else if (other->type != pe_long) + { + // this mismatch was not caught in the initial type resolution pass, + // generate a mismatch (left doesn't match right) error + typeresolution_info ti(session); + ti.assert_resolvability = true; // need this to get it throw errors + ti.mismatch_complexity = 1; // also needed to throw errors + ti.mismatch(e); + } provide (other); return;