aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-05-30 23:04:47 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-05-30 23:04:47 +0000
commitea3ef06a75bcf28c05e16ab5fc0d4f6add4e5db9 (patch)
tree5dc59a805c198ab0f380588273905819f0f699ed /gcc/go
parentfda33f152e2189356b71df582a2ce961e4f951e2 (diff)
downloadgcc-ea3ef06a75bcf28c05e16ab5fc0d4f6add4e5db9.zip
gcc-ea3ef06a75bcf28c05e16ab5fc0d4f6add4e5db9.tar.gz
gcc-ea3ef06a75bcf28c05e16ab5fc0d4f6add4e5db9.tar.bz2
compiler: Don't crash for invalid constant types for && or ||.
From-SVN: r188033
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/expressions.cc18
1 files changed, 3 insertions, 15 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index e609be9..f9c80b3 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -4475,9 +4475,8 @@ Binary_expression::eval_constant(Operator op, Numeric_constant* left_nc,
case OPERATOR_LE:
case OPERATOR_GT:
case OPERATOR_GE:
- // These return boolean values and as such must be handled
- // elsewhere.
- go_unreachable();
+ // These return boolean values, not numeric.
+ return false;
default:
break;
}
@@ -5304,24 +5303,13 @@ Binary_expression::operand_address(Statement_inserter* inserter,
bool
Binary_expression::do_numeric_constant_value(Numeric_constant* nc) const
{
- Operator op = this->op_;
-
- if (op == OPERATOR_EQEQ
- || op == OPERATOR_NOTEQ
- || op == OPERATOR_LT
- || op == OPERATOR_LE
- || op == OPERATOR_GT
- || op == OPERATOR_GE)
- return false;
-
Numeric_constant left_nc;
if (!this->left_->numeric_constant_value(&left_nc))
return false;
Numeric_constant right_nc;
if (!this->right_->numeric_constant_value(&right_nc))
return false;
-
- return Binary_expression::eval_constant(op, &left_nc, &right_nc,
+ return Binary_expression::eval_constant(this->op_, &left_nc, &right_nc,
this->location(), nc);
}