From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8739 invoked by alias); 20 Sep 2014 10:04:57 -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 8688 invoked by uid 89); 20 Sep 2014 10:04:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.2 X-HELO: mail-qc0-f177.google.com Received: from mail-qc0-f177.google.com (HELO mail-qc0-f177.google.com) (209.85.216.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 20 Sep 2014 10:04:55 +0000 Received: by mail-qc0-f177.google.com with SMTP id o8so4143915qcw.8 for ; Sat, 20 Sep 2014 03:04:53 -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:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=rXIfLQsT6WCtNxDZLdaZOPJvRCYPkeSkhBYVVo+RQuQ=; b=iTRiEq7ZgnBrCZNOvPwOECdt9lq9RK2xvSn8u/GBiecB0hel/X+u9t/b2SdPi7PUgr wPTFmJ4gyIk5m6Z+RcYYK+CXDfMpNN9B+zY8eN9L6p40ErcqjdyuuTF8RcSOIb6ihZkS pH0gyXL/F0kSaNW/qObKV1EGeq/ktuMWct8bprosa3xrBUyuXcjw8QBWPISkGBa/Z+xz 7xWHh3C0tIALG+THXC/j++1aI9o8nIssAhOpldEPI2dP4t0SBicE2jXLo1pooXoyDqDA dv1mQSRdkljaM/lK7Eu0xHK+bUSng2vnpZLXYOwNbH1CV15gto7cfMt22yVukQreDq6F MyZg== X-Gm-Message-State: ALoCoQlfpY9+mZnDZfT5Z87X6V29f4dxMgy9ulIIkZIDqnbCNN7cX6s11D48qQNsdlUT7dZYWe1o X-Received: by 10.140.20.105 with SMTP id 96mr7898782qgi.33.1411207493124; Sat, 20 Sep 2014 03:04:53 -0700 (PDT) Received: from localhost (CPE687f74122463-CM84948c2e0610.cpe.net.cable.rogers.com. [99.226.94.59]) by mx.google.com with ESMTPSA id a93sm3354904qga.26.2014.09.20.03.04.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Sep 2014 03:04:50 -0700 (PDT) From: Anthony Green To: Uros Bizjak Cc: libffi-discuss@sourceware.org, "gcc-patches\@gcc.gnu.org" , Richard Henderson , Ian Lance Taylor Subject: Re: [PATCH, libffi, alpha]: Use FFI_ASSERT in ffi_closure_osf_inner References: Date: Sat, 20 Sep 2014 10:04:00 -0000 In-Reply-To: (Uros Bizjak's message of "Mon, 21 Jul 2014 20:21:33 +0200") Message-ID: <8738bmip4u.fsf@moxielogic.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014/txt/msg00084.txt.bz2 [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. AG > > Uros. > > Index: src/alpha/ffi.c > =================================================================== > --- src/alpha/ffi.c (revision 212882) > +++ src/alpha/ffi.c (working copy) > @@ -27,7 +27,6 @@ > > #include > #include > -#include > > /* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; > all further uses in this file will refer to the 128-bit type. */ > @@ -273,7 +272,7 @@ ffi_closure_osf_inner(ffi_closure *closure, void * > break; > > default: > - abort (); > + FFI_ASSERT (0); > } > > argn += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;