From patchwork Fri Sep 10 23:19:21 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: 64477 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 0E1E7B6F10 for ; Sat, 11 Sep 2010 09:19:39 +1000 (EST) Received: (qmail 7137 invoked by alias); 10 Sep 2010 23:19:36 -0000 Received: (qmail 7127 invoked by uid 22791); 10 Sep 2010 23:19:35 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, TW_CC, 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.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Sep 2010 23:19:30 +0000 Received: from kpbe11.cbf.corp.google.com (kpbe11.cbf.corp.google.com [172.25.105.75]) by smtp-out.google.com with ESMTP id o8ANJRY8023533 for ; Fri, 10 Sep 2010 16:19:27 -0700 Received: from pvh1 (pvh1.prod.google.com [10.241.210.193]) by kpbe11.cbf.corp.google.com with ESMTP id o8ANJQjC027956 for ; Fri, 10 Sep 2010 16:19:26 -0700 Received: by pvh1 with SMTP id 1so1356179pvh.23 for ; Fri, 10 Sep 2010 16:19:26 -0700 (PDT) Received: by 10.142.187.19 with SMTP id k19mr475850wff.289.1284160765977; Fri, 10 Sep 2010 16:19:25 -0700 (PDT) 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 t18sm3782585wfc.11.2010.09.10.16.19.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 10 Sep 2010 16:19:25 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: [gccgo] Permit omitting lower bound in a slice expression Date: Fri, 10 Sep 2010 16:19:21 -0700 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 The Go language was tweaked to permit omitting the lower bound in a slice expression. This patch implements that for gccgo. Committed to gccgo branch. Ian diff -r f46918ae9445 go/parse.cc --- a/go/parse.cc Fri Sep 10 11:41:29 2010 -0700 +++ b/go/parse.cc Fri Sep 10 16:17:39 2010 -0700 @@ -2653,8 +2653,10 @@ start = this->expression(PRECEDENCE_NORMAL, false, true, NULL); else { - this->error("missing lower bound in slice expression"); - start = Expression::make_error(this->location()); + mpz_t zero; + mpz_init_set_ui(zero, 0); + start = Expression::make_integer(&zero, NULL, location); + mpz_clear(zero); } Expression* end = NULL;