From patchwork Tue Jan 4 20:18:35 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: 77527 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 3D304B6EDF for ; Wed, 5 Jan 2011 07:24:57 +1100 (EST) Received: (qmail 6681 invoked by alias); 4 Jan 2011 20:24:45 -0000 Received: (qmail 6673 invoked by uid 22791); 4 Jan 2011 20:24:44 -0000 X-SWARE-Spam-Status: No, hits=-2.7 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) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 04 Jan 2011 20:24:38 +0000 Received: from kpbe14.cbf.corp.google.com (kpbe14.cbf.corp.google.com [172.25.105.78]) by smtp-out.google.com with ESMTP id p04KOa8g031437 for ; Tue, 4 Jan 2011 12:24:37 -0800 Received: from pzk28 (pzk28.prod.google.com [10.243.19.156]) by kpbe14.cbf.corp.google.com with ESMTP id p04KNaH5030147 for ; Tue, 4 Jan 2011 12:24:35 -0800 Received: by pzk28 with SMTP id 28so3217843pzk.16 for ; Tue, 04 Jan 2011 12:24:35 -0800 (PST) Received: by 10.142.217.21 with SMTP id p21mr18156821wfg.297.1294172317200; Tue, 04 Jan 2011 12:18:37 -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 o1sm7242477wfl.2.2011.01.04.12.18.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 04 Jan 2011 12:18:36 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Don't crash if a named constant has no type Date: Tue, 04 Jan 2011 12:18:35 -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 When compiling invalid code it's possible for the type to never be set for a named constant. All the cases which care check for NULL except one. This patch fixes the final case. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 6f834ce27f8b go/expressions.cc --- a/go/expressions.cc Tue Jan 04 11:45:52 2011 -0800 +++ b/go/expressions.cc Tue Jan 04 12:15:47 2011 -0800 @@ -2680,7 +2680,8 @@ // object is an abstract int or float, we try to get the abstract // value. Otherwise we may lose something in the conversion. if (this->type_ != NULL - && this->constant_->const_value()->type()->is_abstract()) + && (this->constant_->const_value()->type() == NULL + || this->constant_->const_value()->type()->is_abstract())) { Expression* expr = this->constant_->const_value()->expr(); mpz_t ival;