From patchwork Thu Jan 22 04:09:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 431668 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1625B140182 for ; Thu, 22 Jan 2015 15:10:43 +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:date:message-id:subject:from:to:content-type; q= dns; s=default; b=sox4dZCuv0hIT/qcpopkLERLdOW9PFXXe32SJSiEurGKBh 0yL5hMmZfRNbU7DXIY4GcBvmcIaGUFXLMN47MJuk7H1PIlgd0h+Lpm0HlhS4wvRD wRJucS6LmR2Y3oyNNkhE2wdAvytIFDeiSfomvbTgMWHG0LdsoScQ25IASv+WE= 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:date:message-id:subject:from:to:content-type; s= default; bh=xCKStJhSPrLUs/esMOn+GPOZAeg=; b=AwBO64kRnfSBNZiAnVjy 89mdTXW02MY9XAF5dNVAQZUqAz310rvv6X8yPIBoW/BPxZ6+yJMMgT/MaKyN7EaJ mvNuNxaExdxAhRi5PKB7enjAWKsmpFDyrm5U1b3mXn7odr7iPkVFJtQWVTXDr/S7 lp7Aw+zZPZpkFhQ9ZmjE+U8= Received: (qmail 5992 invoked by alias); 22 Jan 2015 04:10:23 -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 5896 invoked by uid 89); 22 Jan 2015 04:10:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f178.google.com Received: from mail-yk0-f178.google.com (HELO mail-yk0-f178.google.com) (209.85.160.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 22 Jan 2015 04:09:42 +0000 Received: by mail-yk0-f178.google.com with SMTP id 20so21320115yks.9 for ; Wed, 21 Jan 2015 20:09:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=NZfjpecGQR/Ua1KhnGTXXs38h0O4vyYu6jR6i7IYCB8=; b=YDR8rlZJOP9xxDBVzkR1mDFmSJrgILWLeREMqs1p6lwYUDOdFTXcl4zntn+Bum8eEO E55rVpGowpTsVqPnwdhso68T/tlmO6aeYstsevT8isGKZEXox6g5S2r1h3qdpjfLqU3a 20n2vmUDS582mJgjFU33IDIUd6t+Iom33ksqYkQsrNheUTODpYyuGkpTULyCJ2vazPP4 dZdHqdMQEDMeXVRDIchFSk/9RAe2p2JKE0ee1MrtILViiTa0Lr7TAm0EMcm2a+Pb724D oJ1UEcEHS+LdRhD4/VamIZi1bO/Vwhkovzg+ZgZ6gIQDjoLoIJDSorHogCy8ygACAmUS xtZw== X-Gm-Message-State: ALoCoQkshwSKSuhsG3E52bycE+iJU73wf4TbYklpaTwZZZna+SZamFTiyrNFc+wRdpl5T8Ijt7Jm MIME-Version: 1.0 X-Received: by 10.170.115.22 with SMTP id h22mr28502475ykb.37.1421899779080; Wed, 21 Jan 2015 20:09:39 -0800 (PST) Received: by 10.170.57.196 with HTTP; Wed, 21 Jan 2015 20:09:38 -0800 (PST) Date: Wed, 21 Jan 2015 20:09:38 -0800 Message-ID: Subject: Go patch committed: reject invalid ... with call returning multiple results From: Ian Lance Taylor To: gcc-patches , "gofrontend-dev@googlegroups.com" The Go frontend incorrectly accepted ... with a call returning multiple results, as in f(g()...) This is invalid and should not be accepted. This patch from Chris Manghane fixes the problem. This is Go issue 9525. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 2ae1a676004b go/expressions.cc --- a/go/expressions.cc Wed Jan 21 15:03:08 2015 -0800 +++ b/go/expressions.cc Wed Jan 21 20:05:37 2015 -0800 @@ -8580,6 +8580,17 @@ { Call_expression* call = this->args_->front()->call_expression(); call->set_is_multi_value_arg(); + if (this->is_varargs_) + { + // It is not clear which result of a multiple result call + // the ellipsis operator should be applied to. If we unpack the + // the call into its individual results here, the ellipsis will be + // applied to the last result. + error_at(call->location(), + _("multiple-value argument in single-value context")); + return Expression::make_error(call->location()); + } + Expression_list* args = new Expression_list; for (size_t i = 0; i < rc; ++i) args->push_back(Expression::make_call_result(call, i));