public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@avtrex.com>
To: GCJ-patches <java-patches@gcc.gnu.org>,
		GCC Patches <gcc-patches@gcc.gnu.org>
Cc: andreast@gcc.gnu.org
Subject: [Patch] libffi: Fix broken return_ul.c test.
Date: Wed, 01 Aug 2007 08:20:00 -0000	[thread overview]
Message-ID: <46B04209.3000509@avtrex.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 511 bytes --]

The return_ul.c test is failing for mips64 n32 ABI.  The problem is that 
the return value location was too small and was overflowing into 
adjacent memory.

According to the libffi README, return values must be at least as large 
as ffi_arg, so that is what I used.

Tested on x86_64-pc-linux-gnu and mips64-linux-gnu.

OK to commit?

2007-08-01  David Daney  <ddaney@avtrex.com>

    * testsuite/libffi.call/return_ul.c (main): Define return type as
    ffi_arg.  Use proper printf conversion specifier.
   


[-- Attachment #2: ffi-ul.diff --]
[-- Type: text/x-patch, Size: 705 bytes --]

Index: testsuite/libffi.call/return_ul.c
===================================================================
--- testsuite/libffi.call/return_ul.c	(revision 127010)
+++ testsuite/libffi.call/return_ul.c	(working copy)
@@ -16,7 +16,7 @@ int main (void)
   ffi_cif cif;
   ffi_type *args[MAX_ARGS];
   void *values[MAX_ARGS];
-  unsigned long res;
+  ffi_arg res;
   unsigned long ul1, ul2;
 
   args[0] = &ffi_type_ulong;
@@ -31,7 +31,7 @@ int main (void)
   ul2 = 1073741824L;
 
   ffi_call(&cif, FFI_FN(return_ul), &res, values);
-  printf("res: %ld, %ld\n", res, ul1 + ul2);
+  printf("res: %lu, %lu\n", (unsigned long)res, ul1 + ul2);
   /* { dg-output "res: 2147483647, 2147483647" } */
 
   exit(0);

             reply	other threads:[~2007-08-01  8:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-01  8:20 David Daney [this message]
2007-08-02 19:26 ` Andreas Tobler
2007-08-05  9:50 ` Andrew Haley

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=46B04209.3000509@avtrex.com \
    --to=ddaney@avtrex.com \
    --cc=andreast@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=java-patches@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: link
Be 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).