public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Matthias Klose <doko@net.local> To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org Subject: libgcj/9078: libffi: problems with uint8 on powerpc Date: Sat, 28 Dec 2002 03:16:00 -0000 [thread overview] Message-ID: <E18SEr1-0007ft-00@tango.net.local> (raw) >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 <dbelan2@CS.McGill.CA> >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 <stdio.h> #include <ffi.h> 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:
next reply other threads:[~2002-12-28 11:16 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-12-28 3:16 Matthias Klose [this message] 2002-12-29 8:06 Jeff Sturm 2002-12-29 8:13 jsturm 2003-03-16 17:16 Matthias Klose 2003-03-17 3:19 jsturm
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=E18SEr1-0007ft-00@tango.net.local \ --to=doko@net.local \ --cc=173074@bugs.debian.org \ --cc=debian-gcc@lists.debian.org \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).