From patchwork Fri Feb 11 06:36:52 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: 82719 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 AD900B7130 for ; Fri, 11 Feb 2011 17:37:06 +1100 (EST) Received: (qmail 8493 invoked by alias); 11 Feb 2011 06:37:05 -0000 Received: (qmail 8385 invoked by uid 22791); 11 Feb 2011 06:37:04 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, 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; Fri, 11 Feb 2011 06:37:00 +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 p1B6avDC030194 for ; Thu, 10 Feb 2011 22:36:57 -0800 Received: from iwn6 (iwn6.prod.google.com [10.241.68.70]) by kpbe16.cbf.corp.google.com with ESMTP id p1B6atxW016677 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 10 Feb 2011 22:36:56 -0800 Received: by iwn6 with SMTP id 6so2194449iwn.29 for ; Thu, 10 Feb 2011 22:36:55 -0800 (PST) Received: by 10.42.167.69 with SMTP id r5mr184801icy.64.1297406215822; Thu, 10 Feb 2011 22:36:55 -0800 (PST) Received: from coign.google.com (adsl-71-133-8-30.dsl.pltn13.pacbell.net [71.133.8.30]) by mx.google.com with ESMTPS id ey6sm307696icb.5.2011.02.10.22.36.54 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 10 Feb 2011 22:36:55 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Don't crash on if with erroneous conditional Date: Thu, 10 Feb 2011 22:36:52 -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 a crash when an if statement has an erroneous conditional. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r c4d7da5b8d87 go/statements.cc --- a/go/statements.cc Thu Feb 10 22:34:01 2011 -0800 +++ b/go/statements.cc Thu Feb 10 22:35:05 2011 -0800 @@ -2994,7 +2994,9 @@ tree If_statement::do_get_tree(Translate_context* context) { - gcc_assert(this->cond_ == NULL || this->cond_->type()->is_boolean_type()); + gcc_assert(this->cond_ == NULL + || this->cond_->type()->is_boolean_type() + || this->cond_->type()->is_error_type()); tree cond_tree = (this->cond_ == NULL ? boolean_true_node : this->cond_->get_tree(context));