From patchwork Tue Jan 4 22:15:48 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: 77540 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 31E2EB70EA for ; Wed, 5 Jan 2011 09:16:04 +1100 (EST) Received: (qmail 29250 invoked by alias); 4 Jan 2011 22:16:02 -0000 Received: (qmail 29232 invoked by uid 22791); 4 Jan 2011 22:16:00 -0000 X-SWARE-Spam-Status: No, hits=-2.8 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; Tue, 04 Jan 2011 22:15:55 +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 p04MFqGE015240 for ; Tue, 4 Jan 2011 14:15:53 -0800 Received: from iwn2 (iwn2.prod.google.com [10.241.68.66]) by kpbe15.cbf.corp.google.com with ESMTP id p04MFpDd008275 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Tue, 4 Jan 2011 14:15:51 -0800 Received: by iwn2 with SMTP id 2so17051881iwn.35 for ; Tue, 04 Jan 2011 14:15:51 -0800 (PST) Received: by 10.231.200.202 with SMTP id ex10mr6191474ibb.163.1294179351127; Tue, 04 Jan 2011 14:15:51 -0800 (PST) Received: from coign.google.com (dhcp-172-22-123-229.mtv.corp.google.com [172.22.123.229]) by mx.google.com with ESMTPS id 8sm20198100iba.4.2011.01.04.14.15.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 04 Jan 2011 14:15:50 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Don't create erroroneous COND_EXPR Date: Tue, 04 Jan 2011 14:15:48 -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 avoids creating a COND_EXPR with components which are error_mark_node. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r e47e715f0459 go/statements.cc --- a/go/statements.cc Tue Jan 04 13:15:01 2011 -0800 +++ b/go/statements.cc Tue Jan 04 14:13:07 2011 -0800 @@ -2985,14 +2985,19 @@ If_statement::do_get_tree(Translate_context* context) { gcc_assert(this->cond_ == NULL || this->cond_->type()->is_boolean_type()); - tree ret = build3(COND_EXPR, void_type_node, - (this->cond_ == NULL - ? boolean_true_node - : this->cond_->get_tree(context)), - this->then_block_->get_tree(context), - (this->else_block_ == NULL - ? NULL_TREE - : this->else_block_->get_tree(context))); + tree cond_tree = (this->cond_ == NULL + ? boolean_true_node + : this->cond_->get_tree(context)); + tree then_tree = this->then_block_->get_tree(context); + tree else_tree = (this->else_block_ == NULL + ? NULL_TREE + : this->else_block_->get_tree(context)); + if (cond_tree == error_mark_node + || then_tree == error_mark_node + || else_tree == error_mark_node) + return error_mark_node; + tree ret = build3(COND_EXPR, void_type_node, cond_tree, then_tree, + else_tree); SET_EXPR_LOCATION(ret, this->location()); return ret; }