From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14151 invoked by alias); 28 Dec 2002 11:16:04 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 14121 invoked by uid 71); 28 Dec 2002 11:16:03 -0000 Resent-Date: 28 Dec 2002 11:16:03 -0000 Resent-Message-ID: <20021228111603.14120.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, java-prs@gcc.gnu.org, David Paul BELANGER Resent-Reply-To: gcc-gnats@gcc.gnu.org, 173074@bugs.debian.org Received: (qmail 13716 invoked from network); 28 Dec 2002 11:10:21 -0000 Received: from unknown (HELO hirsch.in-berlin.de) (192.109.42.6) by 209.249.29.67 with SMTP; 28 Dec 2002 11:10:21 -0000 Received: from tango.net.local (mail@dsl-213-023-039-145.arcor-ip.net [213.23.39.145]) (authenticated bits=0) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with ESMTP id gBSBA8XR025130 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NOT); Sat, 28 Dec 2002 12:10:09 +0100 Received: from doko by tango.net.local with local (Exim 4.12 #1 (Debian) [+araqnid]) id 18SEr1-0007ft-00; Sat, 28 Dec 2002 12:10:07 +0100 Message-Id: Date: Sat, 28 Dec 2002 03:16:00 -0000 From: Matthias Klose Reply-To: 173074@bugs.debian.org To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org X-Send-Pr-Version: 3.113 X-GNATS-Notify: David Paul BELANGER Subject: libgcj/9078: libffi: problems with uint8 on powerpc X-SW-Source: 2002-12/txt/msg01339.txt.bz2 List-Id: >Number: 9078 >Category: libgcj >Synopsis: libffi: problems with uint8 on powerpc >Confidential: no >Severity: serious >Priority: low >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sat Dec 28 03:16:02 PST 2002 >Closed-Date: >Last-Modified: >Originator: David Paul BELANGER >Release: 3.2.1 (Debian) (Debian unstable) >Organization: The Debian Project >Environment: System: Debian GNU/Linux (unstable) Architecture: i686 host: i386-linux >Description: [ Reported to the Debian BTS as report #173074. Please CC 173074@bugs.debian.org on replies. Log of report can be found at http://bugs.debian.org/173074 ] [ category libgcj, as there is no explicit libffi category] ffi_type_uint8 and other arguments shorter than one word are not passed in correctly to the function called by ffi_call. Also, returns values are not passed correctly. For example, instead of finding the returned byte value where the pointer points to, it is found at an offset of 3 from the pointer. This is related to the fact that the powerpc is a big endian machine and somewhere, bytes need to be moved. I have included code and output I get on my powerpc machine. Thanks, David ----- #include #include unsigned char identity(unsigned char c) { printf("identity: %d\n", c); return c; } int main(void) { ffi_cif cif; ffi_type *args[1]; void *values[1]; int b; unsigned char result; int i; args[0] = &ffi_type_uint; /* * args[0] = &ffi_type_uint8; - if this type is specified, * function always receives 0. */ b = 24; values[0] = &b; if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint8, args) != FFI_OK) { printf("error\n"); return 1; } ffi_call(&cif, identity, &result, values); printf("at result: %d\n", result); printf("at result + 3: %d\n", *(&result + 3)); /* for (i = 0; i < sizeof(result); i++) { printf("byte %d = %d\n", i, *((unsigned char *) &result)); } */ return 0; } ----- output: identity: 24 at result: 0 at result + 3: 24 ----- David >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: