From patchwork Tue Feb 5 18:21:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 1037022 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-495325-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=golang.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="sVHf7P/2"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=golang-org.20150623.gappssmtp.com header.i=@golang-org.20150623.gappssmtp.com header.b="THtE8qOh"; 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 43vCZl6L2wz9s6w for ; Wed, 6 Feb 2019 05:21:35 +1100 (AEDT) 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=dNw6FFaLKQuUnhavTDh0prOeHNx5AJ5BUdKWJ0C85DyUyU yN1X5jrA8Usw1UCLqMye/yWwID6fK2QRUJBdn0SQy2x809Jc5o3dokkhccA3tXCb Jn9MDhpXmfhnRgcS5PzxvvyAkaXCx6A2S6jrVaAK83AwEp1qqv6rE2nfi5gzY= 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=p72I8OJy1qlKHCtXdgJIwPSWN3Y=; b=sVHf7P/25dfFCWkpMn4w Q8++RCr59HKaAOtQpLDm6Boo1xZytnE0As1ZuOQS/YT97+vgEEhEs5UgHm2Bgjjz hI5IXyvRrVF25vhM/HRnK87MYHakzxsS34CmZHSlZKk4E2A4qiEn16/KGycJN4Hg uCH/HrqDzxXYL4/RL8o8Biw= Received: (qmail 13606 invoked by alias); 5 Feb 2019 18:21:28 -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 13596 invoked by uid 89); 5 Feb 2019 18:21:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=ian, HX-Received:59c2, shi, ben X-HELO: mail-lf1-f46.google.com Received: from mail-lf1-f46.google.com (HELO mail-lf1-f46.google.com) (209.85.167.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Feb 2019 18:21:26 +0000 Received: by mail-lf1-f46.google.com with SMTP id l142so3405754lfe.2 for ; Tue, 05 Feb 2019 10:21:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=rUa/ol6XRPIhYk/weDvoSGb8U2u/Vos2nhujbkFPr2Y=; b=THtE8qOhiEY8WpfWHWWSb8+4xR9YiqWWHkFL4rZtNFT9imN3k8sobs5XhxMwyty9C+ ha8GX0PPvazxrPY5ASbgQTX2RxciZySta025CQer1wsIwfXwM6YHj4QxZmLuVA+1PSHl 2RGXPzzGcGktoMBvXZruCX48uIBekvT3/9bz24g6DGHI5QuQK7mJLP8O1PQkS8uLQsHL V7UA9JrdOUEuCr0IeSm4KPs/jtthGMXPu6AQYwFmesOAZ8yY1zFOqeR1x+fPmiogY+Vs EdfQk5gzV/i/RnzK36wcD02TtQvViMiG4CXSepkxdMFG0Hv37GYPJKYPGiSVK9f7WYPn wvRQ== MIME-Version: 1.0 From: Ian Lance Taylor Date: Tue, 5 Feb 2019 10:21:10 -0800 Message-ID: Subject: Go patch committed: Check duplicate implicit indexes in slices/arrays To: gcc-patches , gofrontend-dev This patch by Ben Shi fixes the Go frontend to check duplicate implicit indexes in slices/array composite literals. This fixes https://golang.org/issue/28186. 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 268465) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -047b0aa6a29d46fde99b3e5823339ac8866f797c +347628daf153baf3034b61b2abb4ec39e2ab37c8 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/expressions.cc =================================================================== --- gcc/go/gofrontend/expressions.cc (revision 268369) +++ gcc/go/gofrontend/expressions.cc (working copy) @@ -14244,6 +14244,13 @@ Composite_literal_expression::lower_arra if (index_expr == NULL) { + if (std::find(indexes->begin(), indexes->end(), index) + != indexes->end()) + { + go_error_at(val->location(), + "duplicate value for index %lu", index); + return Expression::make_error(location); + } if (!indexes->empty()) indexes->push_back(index); }