]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: fix bad order of evaluation for min/max builtin
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Mon, 26 Jun 2023 04:30:48 +0000 (11:30 +0700)
committerGopher Robot <gobot@golang.org>
Tue, 27 Jun 2023 18:18:23 +0000 (18:18 +0000)
commit4ad4128d3c09e24f1e901635bd81ba2db7c46764
treea039e8055e43b385d043c4dc08d324d867fffdd7
parent4f36f7e4dd921be455810cc925ca122d71381156
cmd/compile: fix bad order of evaluation for min/max builtin

For float or string, min/max builtin performs a runtime call, so we need
to save its result to temporary variable. Otherwise, the runtime call
will clobber closure's arguments currently on the stack when passing
min/max as argument to closures.

Fixes #60990

Change-Id: I1397800f815ec7853182868678d0f760b22afff2
Reviewed-on: https://go-review.googlesource.com/c/go/+/506115
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/compile/internal/walk/order.go
test/fixedbugs/issue60990.go [new file with mode: 0644]