aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2014-12-15 20:20:22 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2014-12-15 20:20:22 +0000
commit426bcc95cbaed399329579feb14f776d4c2e4525 (patch)
treebd0015db7635dbc061ea3fe5ed9aa50127e50c0d /gcc
parentb07891da2e13689940369c95145feae7c7f1ef47 (diff)
downloadgcc-426bcc95cbaed399329579feb14f776d4c2e4525.zip
gcc-426bcc95cbaed399329579feb14f776d4c2e4525.tar.gz
gcc-426bcc95cbaed399329579feb14f776d4c2e4525.tar.bz2
re PR go/61255 (gccgo: spurious "error: argument 2 has incompatible type" [GoSmith])
PR go/61255 compiler: Copied variadic calls should copy lowering state of arguments. From-SVN: r218764
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/expressions.cc37
-rw-r--r--gcc/go/gofrontend/expressions.h14
2 files changed, 36 insertions, 15 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 90cea39..f6d4381 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -6552,13 +6552,7 @@ class Builtin_call_expression : public Call_expression
do_check_types(Gogo*);
Expression*
- do_copy()
- {
- return new Builtin_call_expression(this->gogo_, this->fn()->copy(),
- this->args()->copy(),
- this->is_varargs(),
- this->location());
- }
+ do_copy();
Bexpression*
do_get_backend(Translate_context*);
@@ -7986,6 +7980,20 @@ Builtin_call_expression::do_check_types(Gogo*)
}
}
+Expression*
+Builtin_call_expression::do_copy()
+{
+ Call_expression* bce =
+ new Builtin_call_expression(this->gogo_, this->fn()->copy(),
+ this->args()->copy(),
+ this->is_varargs(),
+ this->location());
+
+ if (this->varargs_are_lowered())
+ bce->set_varargs_are_lowered();
+ return bce;
+}
+
// Return the backend representation for a builtin function.
Bexpression*
@@ -9126,6 +9134,21 @@ Call_expression::do_check_types(Gogo*)
}
}
+Expression*
+Call_expression::do_copy()
+{
+ Call_expression* call =
+ Expression::make_call(this->fn_->copy(),
+ (this->args_ == NULL
+ ? NULL
+ : this->args_->copy()),
+ this->is_varargs_, this->location());
+
+ if (this->varargs_are_lowered_)
+ call->set_varargs_are_lowered();
+ return call;
+}
+
// Return whether we have to use a temporary variable to ensure that
// we evaluate this call expression in order. If the call returns no
// results then it will inevitably be executed last.
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index 398709e..cbac504 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -1683,6 +1683,11 @@ class Call_expression : public Expression
is_varargs() const
{ return this->is_varargs_; }
+ // Return whether varargs have already been lowered.
+ bool
+ varargs_are_lowered() const
+ { return this->varargs_are_lowered_; }
+
// Note that varargs have already been lowered.
void
set_varargs_are_lowered()
@@ -1738,14 +1743,7 @@ class Call_expression : public Expression
do_check_types(Gogo*);
Expression*
- do_copy()
- {
- return Expression::make_call(this->fn_->copy(),
- (this->args_ == NULL
- ? NULL
- : this->args_->copy()),
- this->is_varargs_, this->location());
- }
+ do_copy();
bool
do_must_eval_in_order() const;