diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-09-28 00:16:57 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-09-28 00:16:57 +0000 |
commit | 6e81d34ea2d144cf48ec89cc9df8c4a479d675ec (patch) | |
tree | 2c71cfb349624a0f9729cc90aedcf9dd028b30d6 /gcc | |
parent | 222e8cb6ca0110e4311be640459d4cb790a6b83d (diff) | |
download | gcc-6e81d34ea2d144cf48ec89cc9df8c4a479d675ec.zip gcc-6e81d34ea2d144cf48ec89cc9df8c4a479d675ec.tar.gz gcc-6e81d34ea2d144cf48ec89cc9df8c4a479d675ec.tar.bz2 |
compiler: resolve importing ambiguity for more complex function calls
Tweak the exporter for inlinable function bodies to work around a
problem with importing of function calls whose function expressions
are not simple function names. In the bug in question, the function
body exporter was writing out a function call of the form
(*(*FuncTyp)(var))(arg)
which produced an export data representation of
*$convert(<type 5>, var)(x)
which is hard to parse unambiguously. Fix: change the export data
emitter to introduce parens around the function expression for more
complex calls.
Testcase for this bug is in CL 197217.
Fixes golang/go#34503.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197122
From-SVN: r276228
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 1e6ca6f..3f2c3dc 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -9112ea664ed9ee5f108158a913812adaf03edf6e +10a1671d94ddc0c39f2f4b039e5ea33358f414c0 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 7d8963e..a72ba24 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -12373,7 +12373,12 @@ Call_expression::do_inlining_cost() const void Call_expression::do_export(Export_function_body* efb) const { + bool simple_call = (this->fn_->func_expression() != NULL); + if (!simple_call) + efb->write_c_string("("); this->fn_->export_expression(efb); + if (!simple_call) + efb->write_c_string(")"); this->export_arguments(efb); } |