From patchwork Wed Dec 22 00:00:47 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: 76349 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 96454B70A3 for ; Wed, 22 Dec 2010 11:07:57 +1100 (EST) Received: (qmail 21417 invoked by alias); 22 Dec 2010 00:07:52 -0000 Received: (qmail 21407 invoked by uid 22791); 22 Dec 2010 00:07:51 -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; Wed, 22 Dec 2010 00:07:45 +0000 Received: from hpaq12.eem.corp.google.com (hpaq12.eem.corp.google.com [172.25.149.12]) by smtp-out.google.com with ESMTP id oBM07hnx026896 for ; Tue, 21 Dec 2010 16:07:43 -0800 Received: from pvg12 (pvg12.prod.google.com [10.241.210.140]) by hpaq12.eem.corp.google.com with ESMTP id oBM07fSc028668 for ; Tue, 21 Dec 2010 16:07:42 -0800 Received: by pvg12 with SMTP id 12so1358509pvg.26 for ; Tue, 21 Dec 2010 16:07:41 -0800 (PST) Received: by 10.142.225.1 with SMTP id x1mr5090863wfg.0.1292976049502; Tue, 21 Dec 2010 16:00:49 -0800 (PST) Received: from coign.google.com (dhcp-172-22-122-207.mtv.corp.google.com [172.22.122.207]) by mx.google.com with ESMTPS id v19sm8253573wfh.12.2010.12.21.16.00.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 21 Dec 2010 16:00:48 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Check for errors building map construction Date: Tue, 21 Dec 2010 16:00:47 -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 patch to the Go frontend checks for errors when building a map construction. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 07f7aa430c8a go/expressions.cc --- a/go/expressions.cc Tue Dec 21 15:46:58 2010 -0800 +++ b/go/expressions.cc Tue Dec 21 15:57:23 2010 -0800 @@ -11181,13 +11181,19 @@ Type* key_type = mt->key_type(); tree id = get_identifier("__key"); - tree key_field = build_decl(loc, FIELD_DECL, id, key_type->get_tree(gogo)); + tree key_type_tree = key_type->get_tree(gogo); + if (key_type_tree == error_mark_node) + return error_mark_node; + tree key_field = build_decl(loc, FIELD_DECL, id, key_type_tree); DECL_CONTEXT(key_field) = struct_type; TYPE_FIELDS(struct_type) = key_field; Type* val_type = mt->val_type(); id = get_identifier("__val"); - tree val_field = build_decl(loc, FIELD_DECL, id, val_type->get_tree(gogo)); + tree val_type_tree = val_type->get_tree(gogo); + if (val_type_tree == error_mark_node) + return error_mark_node; + tree val_field = build_decl(loc, FIELD_DECL, id, val_type_tree); DECL_CONTEXT(val_field) = struct_type; DECL_CHAIN(key_field) = val_field; @@ -11288,6 +11294,8 @@ tree descriptor = gogo->map_descriptor(mt); tree type_tree = this->type_->get_tree(gogo); + if (type_tree == error_mark_node) + return error_mark_node; static tree construct_map_fndecl; tree call = Gogo::call_builtin(&construct_map_fndecl,