From patchwork Fri Sep 27 22:13:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 278689 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 102A62C00A3 for ; Sat, 28 Sep 2013 08:13:40 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=IHrFmZxGthrDCPjGPw7jFQbdoKa9jag1xhf2gIQwZ+1PhyeZ73Nnn LV8uV47ViToWCpDupRTChmK/hWf2mAzMLD3U6oqL06RfCqtfAlCW43qXX1PHB7zA DnrZ78IDE+InZCswtDqp1BmnRZPjkzBuVNLQiR5y3Ps5DWBpv39l4E= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=lFFC1Gj4LQl3ZP2UJ1tdOKQ8tbA=; b=nq7biz+29zs7ZdnaP+fj YYT4OCwz0W1AAF7pgJLMt79YnUpalXAwzJcXbM2ox3RzdnuD0lVyYrPH4O0dXq3p Kb/t0V8tYD/lrJPA1TKnzwy9R+liX556YY+kOEThXv8dLnhZRsLzYzp1WVTkHG1t S19Te0Yf4lmfUchqjkgYahw= Received: (qmail 21678 invoked by alias); 27 Sep 2013 22:13:33 -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 21657 invoked by uid 89); 27 Sep 2013 22:13:33 -0000 Received: from mail-pa0-f41.google.com (HELO mail-pa0-f41.google.com) (209.85.220.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 27 Sep 2013 22:13:33 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED, BAYES_00, T_TVD_MIME_NO_HEADERS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f41.google.com Received: by mail-pa0-f41.google.com with SMTP id bj1so3351366pad.0 for ; Fri, 27 Sep 2013 15:13:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version:content-type; bh=2uxlDhvBAHNuc6WK0E0WP1lhucAHbQAqbHUSi/vKw3A=; b=gkOltgkzopkXzrk4385mVGkltvJ2gC+TQCLOPSVHAecJcKWJtf7rurD8twYErYn06k iHo8Zi5BInLs4luaDUBNjBxDe4w3EypDmOL+vaepkd8XcoGvqVnXgHcQ8rTQcOZV6rXt /28Whv/d9Swstu2P1JfUWKxVYlVa7HoDUjqugP1obyN/UeYnUIj/mQSnOCDPw1xaVAWx Bw3x0ByU2rwA43mizqga+XqHsxaDjcXfSkKQXcga7SPh1Hicu9C0eK3vvH483BOFrP2m qrkszoV3qg3lIEzDtdjFQSZ+HfHuY2LFPVOJXNDqQ97ceYbik1e1rd3Y8St9AtpLkx1V u/cw== X-Gm-Message-State: ALoCoQma+7dxclPbVyeERHiaauVno1nrHZeqY8eFRNSM2x4hY63sLy508v0u8b1/q0tzOGq/jCwZJm69ANMGW56fzhhs23i9CZg8X/jMFtkWytWflfdCEKrDYYTLtjjIR0XkX+uzrjYYkapSZXm1ZpkmceywtqU/8CMHZFm3G00v3pkO9Yn7mVMy/89EfJqTQOah+zyy11jIi0/gAv1zaEc5Eg1/hZARdg== X-Received: by 10.68.125.226 with SMTP id mt2mr9916458pbb.115.1380320010675; Fri, 27 Sep 2013 15:13:30 -0700 (PDT) Received: from iant-glaptop.roam.corp.google.com.google.com ([2620:0:1000:3204:691e:dd6e:de18:4491]) by mx.google.com with ESMTPSA id y5sm10967970pbs.18.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 27 Sep 2013 15:13:30 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: libgo patch committed: Copy stack values onto heap Date: Fri, 27 Sep 2013 15:13:28 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes I realized that in the amd64 implementation of MakeFunc I forgot that it's not OK to just take the address of a value on the stack, since the function might hang onto the address. The value needs to be copied onto the heap first. This patch implements that. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline and 4.8 branch. Ian diff -r cec0db170d82 libgo/go/reflect/makefuncgo_amd64.go --- a/libgo/go/reflect/makefuncgo_amd64.go Fri Sep 27 14:31:06 2013 -0700 +++ b/libgo/go/reflect/makefuncgo_amd64.go Fri Sep 27 15:11:00 2013 -0700 @@ -431,8 +431,14 @@ func amd64Memarg(in []Value, ap uintptr, rt *rtype) ([]Value, uintptr) { ap = align(ap, ptrSize) ap = align(ap, uintptr(rt.align)) - p := Value{rt, unsafe.Pointer(ap), flag(rt.Kind()<