This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Go patch committed: Don't delete old arguments for varargs
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Thu, 24 Feb 2011 07:42:58 -0800
- Subject: Go patch committed: Don't delete old arguments for varargs
In some cases the Go frontend can lower a call expression while
traversing its arguments. This can happen when the call expression
refers to global variables which are initialized with the result of the
call expression. This is an error which is detected later. To avoid a
crash, the compiler has to avoid deleting the argument list which it is
traversing. This patch implements that. Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r 2c8e60df8416 go/expressions.cc
--- a/go/expressions.cc Thu Feb 24 07:17:57 2011 -0800
+++ b/go/expressions.cc Thu Feb 24 07:39:14 2011 -0800
@@ -8281,8 +8281,9 @@
for (size_t i = 0; i < rc; ++i)
args->push_back(Expression::make_call_result(call, i));
// We can't return a new call expression here, because this
- // one may be referenced by Call_result expressions. FIXME.
- delete this->args_;
+ // one may be referenced by Call_result expressions. We
+ // also can't delete the old arguments, because we may still
+ // traverse them somewhere up the call stack. FIXME.
this->args_ = args;
}
}