From patchwork Thu Feb 24 15:42:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 84407 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 01CD6B70BA for ; Fri, 25 Feb 2011 02:43:14 +1100 (EST) Received: (qmail 21245 invoked by alias); 24 Feb 2011 15:43:11 -0000 Received: (qmail 21236 invoked by uid 22791); 24 Feb 2011 15:43:09 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Feb 2011 15:43:05 +0000 Received: from kpbe15.cbf.corp.google.com (kpbe15.cbf.corp.google.com [172.25.105.79]) by smtp-out.google.com with ESMTP id p1OFh2d0019490 for ; Thu, 24 Feb 2011 07:43:02 -0800 Received: from qwh6 (qwh6.prod.google.com [10.241.194.198]) by kpbe15.cbf.corp.google.com with ESMTP id p1OFgvpM004618 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 24 Feb 2011 07:43:01 -0800 Received: by qwh6 with SMTP id 6so577796qwh.31 for ; Thu, 24 Feb 2011 07:43:00 -0800 (PST) Received: by 10.229.232.3 with SMTP id js3mr761215qcb.182.1298562180550; Thu, 24 Feb 2011 07:43:00 -0800 (PST) Received: from coign.google.com (dsl-69-50-48-163.pivot.net [69.50.48.163]) by mx.google.com with ESMTPS id p13sm5530041qcu.41.2011.02.24.07.42.59 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 24 Feb 2011 07:43:00 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Don't delete old arguments for varargs Date: Thu, 24 Feb 2011 07:42:58 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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; } }