Skip to content

Commit 5706ab6

Browse files
author
ian
committed
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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227227 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 7ebdc88 commit 5706ab6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

gcc/go/gofrontend/MERGE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
d5e6af4e6dd456075a1ec1c03d0dc41cbea5eb36
1+
cd5362c7bb0b207f484a8dfb8db229fd2bffef09
22

33
The first line of this file holds the git revision number of the last
44
merge done from the gofrontend repository.

gcc/go/gofrontend/expressions.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15150,7 +15150,11 @@ Numeric_constant::set_type(Type* type, bool issue_error, Location loc)
1515015150
else if (type->complex_type() != NULL)
1515115151
ret = this->check_complex_type(type->complex_type(), issue_error, loc);
1515215152
else
15153-
go_unreachable();
15153+
{
15154+
ret = false;
15155+
if (issue_error)
15156+
go_assert(saw_errors());
15157+
}
1515415158
if (ret)
1515515159
this->type_ = type;
1515615160
return ret;

0 commit comments

Comments
 (0)