From patchwork Fri Sep 15 21:07:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 814403 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-462299-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="tbvX3s03"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xv7KM47B3z9s3w for ; Sat, 16 Sep 2017 07:08:07 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=f6O6RnGuXWdOFW6sfMZEoe1b5E2BSdlPCTn8TrMIJuzv0r DSNH99tlH6yIzEu/sKEShrmiCqe4mi/RkwhrLBEYXgUMbeoIug7VJwn8JwwPs3wa UPKQLXGIZxvXz2Tbi+bwKLmhy2MOu7RiU6scF43i9xlQNRyn2zzEMCJ6sO794= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=TFnRUArpwC40G50uLrih+h//Y2U=; b=tbvX3s03/Y6QQTuIVk3P Oh8arggehzQIw9x5sgjZyLSV++1MmPZvrPbQWrkgZkLQ1uTfzn9IyrG7GWVYTBNN WX4hmVH+e48yZmVYBwR85+erpsNzMeBQ8bfK6pdf4O/xrwR2JaNetqTYPnSIDL5O VHuQ7o2iENkLpahbC5w7wmc= Received: (qmail 82040 invoked by alias); 15 Sep 2017 21:08:00 -0000 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 Received: (qmail 82015 invoked by uid 89); 15 Sep 2017 21:07:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Cherry X-HELO: mail-pg0-f42.google.com Received: from mail-pg0-f42.google.com (HELO mail-pg0-f42.google.com) (74.125.83.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Sep 2017 21:07:58 +0000 Received: by mail-pg0-f42.google.com with SMTP id k193so2170130pgc.8 for ; Fri, 15 Sep 2017 14:07:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=h9pDPJV6ZfAGvWBAaTbXjvmjzI0rAMA9ByM+SZm9B8c=; b=bEMk/cSlq1UVESgmARbCzRoBjviDjobPjTx5vcpPg8S/TFlztG3x/51xK2Z5O1mAju C0zoKqhQLAUR+951lyhDgHmeraDylwbXDe5COV0kDj4QjZQEIT4xbJPWI+i5DSTmBNFE LEtCcfI/VO1OenwrRxq8WEcKHtu8KOpUZsZn+P8PS31gFvqYlXmoeiPsIgzJz+3BKbMj +tGSKdgNbqrUc3GBkhZrB6kVcmnKnPLT1m5jybNNpabsAWdJ26+PKyvjEWuoh14KU31b u3qdK0r2/cgRlP/RyRhSJRKiJhF/VKtQmgo7yAWdmGcKHv3UuRv73JjxbeDLVqdl0dRl lLNA== X-Gm-Message-State: AHPjjUiCqIKf/ofacuJjNjd8ooeLs6Hfw5KoM8+CqAOB53y1gA2WMNOb F1w4p2pDQ/g9pTZ6bhM01JxCAwMGpR3Hzz8oYwZD9uq8 X-Google-Smtp-Source: ADKCNb6m5hrP/44znXmWe6OujvLXkTcA8FItlNGxo4Ve9g0CiWKPG6sUBWTTlMfhl/TELcGp56J+Njfy/hKyrULblek= X-Received: by 10.99.9.65 with SMTP id 62mr21669447pgj.395.1505509676930; Fri, 15 Sep 2017 14:07:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.182.173 with HTTP; Fri, 15 Sep 2017 14:07:56 -0700 (PDT) From: Ian Lance Taylor Date: Fri, 15 Sep 2017 14:07:56 -0700 Message-ID: Subject: Go patch committed: check for error expression in Array_type::get_backend_length To: gcc-patches , "gofrontend-dev@googlegroups.com" This patch by Cherry Zhang to the Go frontend checks for an error expression in Array_type::get_backend_length. Otherwise, a zero length is created in the backend and the backend doesn't know there is an error. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 252767) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -4e063a8eee636cce17aea48c7183e78431174de3 +de7b370901c4fc6852eaa7372282bb699429ec4a The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/types.cc =================================================================== --- gcc/go/gofrontend/types.cc (revision 252746) +++ gcc/go/gofrontend/types.cc (working copy) @@ -7638,6 +7638,11 @@ Array_type::get_backend_length(Gogo* gog go_assert(this->length_ != NULL); if (this->blength_ == NULL) { + if (this->length_->is_error_expression()) + { + this->blength_ = gogo->backend()->error_expression(); + return this->blength_; + } Numeric_constant nc; mpz_t val; if (this->length_->numeric_constant_value(&nc) && nc.to_int(&val))