From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14388 invoked by alias); 8 Apr 2013 11:19:25 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 14314 invoked by uid 48); 8 Apr 2013 11:19:18 -0000 From: "krebbel at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libffi/56033] FAIL: libffi.call/cls_struct_va1.c on powerpc-*-* and sparc-sun-solaris2* with -m64 Date: Mon, 08 Apr 2013 11:19:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libffi X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: krebbel at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.1 X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg00617.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56033 Andreas Krebbel changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |krebbel at gcc dot gnu.org --- Comment #5 from Andreas Krebbel 2013-04-08 11:19:16 UTC --- Confirmed for s390x. Looks like an endianess issue to me. In cls_struct_va1.c the void pointer to the return value is cast to an int pointer before writing to it: static void test_fn (ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { ... * (int*) resp = 42; } But the pointer later on is expected to point to a register size value. There are also testcases which do it differently (e.g. closure_fn0.c). They cast the pointer to the return value to ffi_arg* before accessing it. ffi_arg is defined to be a register size type. From the documentation I cannot tell which one is supposed to be correct. static void closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = ... } Btw. for both examples the return type is defined as &ffi_type_sint in ffi_prep_cif