From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24775 invoked by alias); 1 Mar 2013 14:43:36 -0000 Received: (qmail 24759 invoked by uid 22791); 1 Mar 2013 14:43:34 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD,TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-ob0-f171.google.com (HELO mail-ob0-f171.google.com) (209.85.214.171) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Mar 2013 14:43:26 +0000 Received: by mail-ob0-f171.google.com with SMTP id x4so792505obh.30 for ; Fri, 01 Mar 2013 06:43:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=bFn1a8PmXGIj/zPrPiAOa41irulUepqlBSUv+JNodkw=; b=Pdh3AV+WfjmgFe3qIhDhqZXniiBAoRd/AcR3/2nVXd9W/4VyjXYtk/W+4ztDxUpI7v hIR05ZtUPUSdXOWlUIfXO5mGYNP9Dn8xcLfseTlmeF1SNq6UWp18qnaMmBs+zeCJ4qJz 5znU7AuqiIqHeO2BQu8L2ylNqktnR1jVVk4694dKDNTo1VU2dn3f/+MXJ0S0ULBTr+jC 3q9sUo1az/tdrmc5RfpqX/eQVh6rH6LG/zlBXAxfvwylRdVAbr0KPYKpA+L1QuF6Z3jm MDyT/dVxBu1JnYyb6+NRZEnaKxDrxlcHbxSRl+75SzHcqTD8Ktg/Ovuznk3h0nWRdYTy /ziA== MIME-Version: 1.0 X-Received: by 10.60.172.108 with SMTP id bb12mr8856196oec.110.1362149005796; Fri, 01 Mar 2013 06:43:25 -0800 (PST) Received: by 10.182.127.6 with HTTP; Fri, 1 Mar 2013 06:43:25 -0800 (PST) In-Reply-To: References: Date: Fri, 01 Mar 2013 14:43:00 -0000 Message-ID: Subject: Re: [PATCH, go] Passing Complex64 and Complex128 values via reflect.Call (using libffi) introduces ABI mismatch From: Ian Lance Taylor To: Uros Bizjak Cc: gcc-patches , gofrontend-dev@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmvHcUPHAh157Lwdl4VHtyRH/aE8I2imRI8GIahORZ2rrtf0CN0r2nz7ig16mgd0Es4ALUNpbBCmas7qJIggOXsiNTWlwLdWLhKnICoUrk6tSI7lY9yKWTDn5tgC9S6IhOtTdpiasGv/2m6pqERr0cVPEwObcewgIzLLR+FJvr9G7DfiQ0AfMN0rRcp9bV5expCpqDo X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2013-03/txt/msg00020.txt.bz2 On Fri, Mar 1, 2013 at 4:57 AM, Uros Bizjak wrote: > > Due to the fact that libFFI does not handle C99 _Complex arguments > correctly [1], libgo passes Complex64 and Complex128 arguments via a > temporary structure. However, passing parts of complex number in a > structure is not the same as passing true C99 _Complex value, so this > workaround introduces ABI mismatch between caller and callee. This > mismatch results in wrong passed values of complex types. > > Fortunately all x86 ABIs tolerate this mismatch, but other targets > (i.e. alpha) don't have this privilege. Is there a PR open against libffi? Do we have any idea which targets pass complex in a manner different than a struct of two float/doubles? Your patch assumes that only x86 targets work, but I would expect that many targets work that way. Ian