From a8b9ee6feb54764859c6f113983255a6dec897d6 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 11 Jul 2019 21:37:33 +0000 Subject: compiler: ensure evaluation order in type hash/eq functions The type hash and equality functions are generated after the order_evaluations pass. They may contain shortcut operators and Set_and_use_temporary_expressions (e.g. from lowering a Binary_exprssion) that need to be ordered. Run order_evaluations and remove_shortcuts on these functions. (The hash functions may be fine, but to be on the safe side we run on them anyway. We do need to run on the equality functions.) A Set_and_use_temporary_expression is effectively an assignment, so it needs to be ordered. Otherwise if we insert a temporary statement before it, we may get wrong evaluation order. A test case is CL 185818. Fixes golang/go#33062. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/185817 From-SVN: r273425 --- gcc/go/gofrontend/expressions.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/go/gofrontend/expressions.h') diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index 2c6a080..3b65e7a 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -1628,6 +1628,10 @@ class Set_and_use_temporary_expression : public Expression } bool + do_must_eval_in_order() const + { return true; } + + bool do_is_addressable() const { return true; } -- cgit v1.1