From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17161 invoked by alias); 21 Sep 2014 09:17:22 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 17140 invoked by uid 89); 21 Sep 2014 09:17:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f50.google.com Received: from mail-la0-f50.google.com (HELO mail-la0-f50.google.com) (209.85.215.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 21 Sep 2014 09:17:20 +0000 Received: by mail-la0-f50.google.com with SMTP id ty20so5306273lab.9 for ; Sun, 21 Sep 2014 02:17:17 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.8.131 with SMTP id r3mr18212578laa.3.1411291036916; Sun, 21 Sep 2014 02:17:16 -0700 (PDT) Received: by 10.152.1.193 with HTTP; Sun, 21 Sep 2014 02:17:16 -0700 (PDT) In-Reply-To: <8738bmip4u.fsf@moxielogic.com> References: <8738bmip4u.fsf@moxielogic.com> Date: Sun, 21 Sep 2014 09:17:00 -0000 Message-ID: Subject: Re: [PATCH, libffi, alpha]: Use FFI_ASSERT in ffi_closure_osf_inner From: Uros Bizjak To: Anthony Green Cc: libffi-discuss@sourceware.org, "gcc-patches@gcc.gnu.org" , Richard Henderson , Ian Lance Taylor Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2014/txt/msg00090.txt.bz2 On Sat, Sep 20, 2014 at 12:04 PM, Anthony Green wrote: > > [replying to an ancient post here..] > > Uros Bizjak writes: > >> Hello! >> >> Attached patch fixes libgo reflect test failure with libffi closures. >> The gccgo compiler started to use FFI closures recently; the compiler >> passes ffi_type_void for structures with zero members. > > Why not just pass an FFI_TYPE_STRUCT with zero members? > >> ffi_call form src/alpha/ffi.c allows FFI_TYPE_VOID arguments in >> non-debug mode through the default: case, but ffi_closure_osf_inner >> aborts with this type of argument. >> >> The patch changes the default case in ffi_closure_osf_inner from abort >> to FFI_ASSERT, an this way synchronizes argument handling in both >> cases. >> >> 2014-07-21 Uros Bizjak >> >> * src/alpha/ffi.c: Do not include stdlib.h. >> (ffi_closure_osf_inner) : Use FFI_ASSERT instead of abort. >> >> Patch was tested with libffi testsuite on alphaev6-linux-gnu. >> Additionally, the patch fixed reflect test from the libgo testsuite >> and go.test/test/recover.go test from the gcc testsuite. > > Why not add an FFI_TYPE_VOID case so it doesn't ever abort if that's > expected behaviour? The default case is there to catch unexpected > values. The patch just equalizes handling of unknown arguments to ffi_call. Also, the approach is the same as for x86_64 and i386 - these targets doesn't abort for unknown arguments. There is no problem in adding handling of FFI_TYPE_VOID to both functions, if this is the preferred solution. Uros.