From patchwork Tue Dec 7 22:27:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 74609 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 6A93FB6EF1 for ; Wed, 8 Dec 2010 09:27:50 +1100 (EST) Received: (qmail 32500 invoked by alias); 7 Dec 2010 22:27:46 -0000 Received: (qmail 32489 invoked by uid 22791); 7 Dec 2010 22:27:45 -0000 X-SWARE-Spam-Status: No, hits=-2.3 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) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Dec 2010 22:27:39 +0000 Received: from kpbe16.cbf.corp.google.com (kpbe16.cbf.corp.google.com [172.25.105.80]) by smtp-out.google.com with ESMTP id oB7MRb6S013955 for ; Tue, 7 Dec 2010 14:27:37 -0800 Received: from pvg7 (pvg7.prod.google.com [10.241.210.135]) by kpbe16.cbf.corp.google.com with ESMTP id oB7MRaFj031346 for ; Tue, 7 Dec 2010 14:27:36 -0800 Received: by pvg7 with SMTP id 7so109974pvg.8 for ; Tue, 07 Dec 2010 14:27:36 -0800 (PST) Received: by 10.142.115.6 with SMTP id n6mr1618703wfc.169.1291760856393; Tue, 07 Dec 2010 14:27:36 -0800 (PST) Received: from coign.google.com (dhcp-172-22-123-203.mtv.corp.google.com [172.22.123.203]) by mx.google.com with ESMTPS id p8sm9534676wff.16.2010.12.07.14.27.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 07 Dec 2010 14:27:35 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Don't crash on erroneous result variable Date: Tue, 07 Dec 2010 14:27:33 -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 This Go frontend patch avoids a crash when a result variable has an erroneous type. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 2580746c6973 go/gogo-tree.cc --- a/go/gogo-tree.cc Mon Dec 06 22:25:42 2010 -0800 +++ b/go/gogo-tree.cc Tue Dec 07 13:45:07 2010 -0800 @@ -1550,14 +1550,18 @@ else if ((*p)->is_result_variable()) { tree var_decl = (*p)->get_tree(gogo, named_function); - if ((*p)->result_var_value()->is_in_heap()) + if (var_decl != error_mark_node + && (*p)->result_var_value()->is_in_heap()) { gcc_assert(TREE_CODE(var_decl) == INDIRECT_REF); var_decl = TREE_OPERAND(var_decl, 0); } - gcc_assert(TREE_CODE(var_decl) == VAR_DECL); - DECL_CHAIN(var_decl) = declare_vars; - declare_vars = var_decl; + if (var_decl != error_mark_node) + { + gcc_assert(TREE_CODE(var_decl) == VAR_DECL); + DECL_CHAIN(var_decl) = declare_vars; + declare_vars = var_decl; + } } } *pp = NULL_TREE;