]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: do not report division by error during typecheck
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 8 Jun 2023 02:58:22 +0000 (09:58 +0700)
committerGopher Robot <gobot@golang.org>
Thu, 15 Jun 2023 18:41:09 +0000 (18:41 +0000)
commit60e6afb689f97ecddb31496f68f351cc01f2a174
tree78158d0a9cdf5f1a79c481d87cb4fa1d7284cbc5
parentf6e0dcc4742ed413c1dacba28a60b919186e636d
cmd/compile: do not report division by error during typecheck

types2 have already errored about any spec-required overflows, and
division by zero. CL 469595 unintentionally fixed typecheck not to error
about overflows, but zero division is still be checked during tcArith.
This causes unsafe operations with variable size failed to compile,
instead of raising runtime error.

Fixes #60601

Change-Id: I7bea2821099556835c920713397f7c5d8a4025ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/501735
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/compile/internal/typecheck/expr.go
test/fixedbugs/issue60601.go [new file with mode: 0644]