From f36defc3f327015af9a074bd6adc008a6bee69d6 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 25 Oct 2019 19:10:34 +0000 Subject: [PATCH] compiler: don't inline integer expressions with named types This works around the problem on GCC 9 branch. The problem is fixed in a better way on trunk; see https://golang.org/issue/34577. Fixes https://golang.org/issue/35154 From-SVN: r277461 --- gcc/go/gofrontend/expressions.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 6f9775dd5a20..859c1ece5da9 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -2036,7 +2036,11 @@ class Integer_expression : public Expression int do_inlining_cost() const - { return 1; } + { + if (this->type_ != NULL && this->type_->named_type() != NULL) + return 0x100000; + return 1; + } void do_export(Export_function_body*) const; @@ -2451,7 +2455,11 @@ class Float_expression : public Expression int do_inlining_cost() const - { return 1; } + { + if (this->type_ != NULL && this->type_->named_type() != NULL) + return 0x100000; + return 1; + } void do_export(Export_function_body*) const; @@ -2664,7 +2672,11 @@ class Complex_expression : public Expression int do_inlining_cost() const - { return 2; } + { + if (this->type_ != NULL && this->type_->named_type() != NULL) + return 0x100000; + return 2; + } void do_export(Export_function_body*) const; -- 2.47.3