Commit 8a256400 by Ian Lance Taylor

compiler: Don't crash on invalid arithmetic ops.

    
    The gofrontend would crash after hitting an unreachable state while
    trying to determine the type of an arithmetic expression involving
    non-numeric values.  Instead of crashing, it should fail gracefully
    if the relevant error is already reported.
    
    Fixes golang/go#11537.
    
    Reviewed-on: https://go-review.googlesource.com/13793

From-SVN: r227227
parent e4f019d3
d5e6af4e6dd456075a1ec1c03d0dc41cbea5eb36 cd5362c7bb0b207f484a8dfb8db229fd2bffef09
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -15150,7 +15150,11 @@ Numeric_constant::set_type(Type* type, bool issue_error, Location loc) ...@@ -15150,7 +15150,11 @@ Numeric_constant::set_type(Type* type, bool issue_error, Location loc)
else if (type->complex_type() != NULL) else if (type->complex_type() != NULL)
ret = this->check_complex_type(type->complex_type(), issue_error, loc); ret = this->check_complex_type(type->complex_type(), issue_error, loc);
else else
go_unreachable(); {
ret = false;
if (issue_error)
go_assert(saw_errors());
}
if (ret) if (ret)
this->type_ = type; this->type_ = type;
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment