public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments.
@ 2003-11-28 18:59 hos at tamanegi dot org
  2003-11-28 19:03 ` [Bug other/13221] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: hos at tamanegi dot org @ 2003-11-28 18:59 UTC (permalink / raw)
  To: gcc-bugs

In 32bit x86 platform, libffi's closure couldn't pass sequence of char
and/or short type arguments.
Minimum test program is append below.

This probrem maybe fix by following patch below, because passing
arguments are always alignment 4bytes (Also if argument size was less
than 4bytes).

--

/* test program */

#include <ffi.h>

void test_func(ffi_cif *cif, void *rval, void **avals, void *data)
{
    printf("%d, %d\n", *(char *)avals[0], *(char *)avals[1]);
}

main()
{
    ffi_cif cif;
    ffi_closure closure;
    ffi_type *args[2];

    args[0] = &ffi_type_schar;
    args[1] = &ffi_type_schar;

    ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_void, args);
    ffi_prep_closure(&closure, &cif, test_func, NULL);

    ((void(*)(char, char))(&closure))(1, 2);
}

--

Index: ffi.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libffi/src/x86/ffi.c,v
retrieving revision 1.10
diff -u -r1.10 ffi.c
--- ffi.c	21 Mar 2003 13:43:20 -0000	1.10
+++ ffi.c	28 Nov 2003 17:25:13 -0000
@@ -301,8 +301,8 @@
       size_t z;
 
       /* Align if necessary */
-      if (((*p_arg)->alignment - 1) & (unsigned) argp) {
-	argp = (char *) ALIGN(argp, (*p_arg)->alignment);
+      if ((sizeof(int) - 1) & (unsigned) argp) {
+	argp = (char *) ALIGN(argp, sizeof(int));
       }
 
       z = (*p_arg)->size;

-- 
           Summary: libffi's closure couldn't pass sequence of char and/or
                    short arguments.
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hos at tamanegi dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13221


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug other/13221] libffi's closure couldn't pass sequence of char and/or short arguments.
  2003-11-28 18:59 [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments hos at tamanegi dot org
@ 2003-11-28 19:03 ` pinskia at gcc dot gnu dot org
  2003-11-28 19:12 ` andreast at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-28 19:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-28 19:03 -------
Can you sent the patch to gcc-patches@?
Andreas what can you say about this patch and test case?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andreast at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-28 19:03:17
               date|                            |
   Target Milestone|---                         |3.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13221


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug other/13221] libffi's closure couldn't pass sequence of char and/or short arguments.
  2003-11-28 18:59 [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments hos at tamanegi dot org
  2003-11-28 19:03 ` [Bug other/13221] " pinskia at gcc dot gnu dot org
@ 2003-11-28 19:12 ` andreast at gcc dot gnu dot org
  2003-11-30  7:01 ` andreast at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: andreast at gcc dot gnu dot org @ 2003-11-28 19:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From andreast at gcc dot gnu dot org  2003-11-28 19:12 -------
I'll check the type of test case. I think I already added something like this.
But I could be wrong. If not I'll add it.
Thanks.

Regarding the patch, I hope an x86 expert can speak up. I don't own such
architectures :)

 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13221


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug other/13221] libffi's closure couldn't pass sequence of char and/or short arguments.
  2003-11-28 18:59 [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments hos at tamanegi dot org
  2003-11-28 19:03 ` [Bug other/13221] " pinskia at gcc dot gnu dot org
  2003-11-28 19:12 ` andreast at gcc dot gnu dot org
@ 2003-11-30  7:01 ` andreast at gcc dot gnu dot org
  2003-11-30  8:26 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: andreast at gcc dot gnu dot org @ 2003-11-30  7:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From andreast at gcc dot gnu dot org  2003-11-30 07:01 -------
I added some testcases for this bug:

http://gcc.gnu.org/ml/gcc-patches/2003-11/msg02305.html

With this patch from Hosaka Yuji the failures go away:

http://gcc.gnu.org/ml/gcc-patches/2003-11/msg02311.html

He reported success on the above testcases.
Native configuration is i686-pc-linux-gnu

=== libffi Summary ===

# of expected passes		182
# of unsupported tests		2

So hope to get some feedback from a x86 responsible.

Nevertheless, I'll commit the testcases soon as part of the testsuite.

I also would like to commit the patch if it is ok. But here I need ok for approval.






-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|andreast at gcc dot gnu dot |
                   |org                         |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13221


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug other/13221] libffi's closure couldn't pass sequence of char and/or short arguments.
  2003-11-28 18:59 [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments hos at tamanegi dot org
                   ` (2 preceding siblings ...)
  2003-11-30  7:01 ` andreast at gcc dot gnu dot org
@ 2003-11-30  8:26 ` pinskia at gcc dot gnu dot org
  2003-12-01  7:23 ` cvs-commit at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-30  8:26 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
   Last reconfirmed|2003-11-28 19:03:17         |2003-11-30 08:26:13
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13221


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug other/13221] libffi's closure couldn't pass sequence of char and/or short arguments.
  2003-11-28 18:59 [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments hos at tamanegi dot org
                   ` (3 preceding siblings ...)
  2003-11-30  8:26 ` pinskia at gcc dot gnu dot org
@ 2003-12-01  7:23 ` cvs-commit at gcc dot gnu dot org
  2003-12-02  1:21 ` zack at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-12-01  7:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-12-01 07:23 -------
Subject: Bug 13221

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	andreast@gcc.gnu.org	2003-12-01 07:23:28

Modified files:
	libffi         : ChangeLog 
	libffi/testsuite/libffi.special: unwindtest.cc 
Added files:
	libffi/testsuite/libffi.call: cls_multi_sshort.c 
	                              cls_multi_sshortchar.c 
	                              cls_multi_uchar.c 
	                              cls_multi_schar.c 
	                              cls_multi_ushortchar.c 
	                              cls_multi_ushort.c 

Log message:
	2003-12-01  Andreas Tobler  <a.tobler@schweiz.ch>
	
	PR other/13221
	* testsuite/libffi.call/cls_multi_sshort.c: New test case.
	* testsuite/libffi.call/cls_multi_sshortchar.c: Likewise.
	* testsuite/libffi.call/cls_multi_uchar.c: Likewise.
	* testsuite/libffi.call/cls_multi_schar.c: Likewise.
	* testsuite/libffi.call/cls_multi_ushortchar.c: Likewise.
	* testsuite/libffi.call/cls_multi_ushort.c: Likewise.
	
	* testsuite/libffi.special/unwindtest.cc: Cosmetics.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/ChangeLog.diff?cvsroot=gcc&r1=1.147&r2=1.148
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/testsuite/libffi.special/unwindtest.cc.diff?cvsroot=gcc&r1=1.6&r2=1.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/testsuite/libffi.call/cls_multi_sshort.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/testsuite/libffi.call/cls_multi_sshortchar.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/testsuite/libffi.call/cls_multi_uchar.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/testsuite/libffi.call/cls_multi_schar.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/testsuite/libffi.call/cls_multi_ushortchar.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/testsuite/libffi.call/cls_multi_ushort.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13221


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug other/13221] libffi's closure couldn't pass sequence of char and/or short arguments.
  2003-11-28 18:59 [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments hos at tamanegi dot org
                   ` (4 preceding siblings ...)
  2003-12-01  7:23 ` cvs-commit at gcc dot gnu dot org
@ 2003-12-02  1:21 ` zack at gcc dot gnu dot org
  2003-12-02  1:22 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zack at gcc dot gnu dot org @ 2003-12-02  1:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at gcc dot gnu dot org  2003-12-02 01:21 -------
patch observed to have been checked in

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13221


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug other/13221] libffi's closure couldn't pass sequence of char and/or short arguments.
  2003-11-28 18:59 [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments hos at tamanegi dot org
                   ` (5 preceding siblings ...)
  2003-12-02  1:21 ` zack at gcc dot gnu dot org
@ 2003-12-02  1:22 ` pinskia at gcc dot gnu dot org
  2003-12-02  1:24 ` zack at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-02  1:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-02 01:22 -------
That was only the testsuite patch :).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13221


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug other/13221] libffi's closure couldn't pass sequence of char and/or short arguments.
  2003-11-28 18:59 [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments hos at tamanegi dot org
                   ` (6 preceding siblings ...)
  2003-12-02  1:22 ` pinskia at gcc dot gnu dot org
@ 2003-12-02  1:24 ` zack at gcc dot gnu dot org
  2003-12-02  5:23 ` zack at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: zack at gcc dot gnu dot org @ 2003-12-02  1:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at gcc dot gnu dot org  2003-12-02 01:24 -------
Why is (*p_arg)->alignment wrong?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13221


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug other/13221] libffi's closure couldn't pass sequence of char and/or short arguments.
  2003-11-28 18:59 [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments hos at tamanegi dot org
                   ` (7 preceding siblings ...)
  2003-12-02  1:24 ` zack at gcc dot gnu dot org
@ 2003-12-02  5:23 ` zack at gcc dot gnu dot org
  2003-12-02  5:39 ` cvs-commit at gcc dot gnu dot org
  2003-12-02  5:43 ` andreast at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: zack at gcc dot gnu dot org @ 2003-12-02  5:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at gcc dot gnu dot org  2003-12-02 05:23 -------
... after some discussion on IRC it was determined that (*p_arg)->alignment is
generic, and so the patch from Hosaka Yuji is correct.  Please check that in and
close the bug report.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13221


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug other/13221] libffi's closure couldn't pass sequence of char and/or short arguments.
  2003-11-28 18:59 [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments hos at tamanegi dot org
                   ` (8 preceding siblings ...)
  2003-12-02  5:23 ` zack at gcc dot gnu dot org
@ 2003-12-02  5:39 ` cvs-commit at gcc dot gnu dot org
  2003-12-02  5:43 ` andreast at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-12-02  5:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-12-02 05:39 -------
Subject: Bug 13221

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	andreast@gcc.gnu.org	2003-12-02 05:39:07

Modified files:
	libffi         : ChangeLog 
	libffi/src/x86 : ffi.c 

Log message:
	2003-12-02  Hosaka Yuji  <hos@tamanegi.org>
	
	PR other/13221
	* src/x86/ffi.c (ffi_prep_args, ffi_prep_incoming_args_SYSV):
	Align arguments to 32 bits.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/ChangeLog.diff?cvsroot=gcc&r1=1.148&r2=1.149
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libffi/src/x86/ffi.c.diff?cvsroot=gcc&r1=1.10&r2=1.11



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13221


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug other/13221] libffi's closure couldn't pass sequence of char and/or short arguments.
  2003-11-28 18:59 [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments hos at tamanegi dot org
                   ` (9 preceding siblings ...)
  2003-12-02  5:39 ` cvs-commit at gcc dot gnu dot org
@ 2003-12-02  5:43 ` andreast at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: andreast at gcc dot gnu dot org @ 2003-12-02  5:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From andreast at gcc dot gnu dot org  2003-12-02 05:43 -------
Done so.

Andreas

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13221


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2003-12-02  5:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-28 18:59 [Bug other/13221] New: libffi's closure couldn't pass sequence of char and/or short arguments hos at tamanegi dot org
2003-11-28 19:03 ` [Bug other/13221] " pinskia at gcc dot gnu dot org
2003-11-28 19:12 ` andreast at gcc dot gnu dot org
2003-11-30  7:01 ` andreast at gcc dot gnu dot org
2003-11-30  8:26 ` pinskia at gcc dot gnu dot org
2003-12-01  7:23 ` cvs-commit at gcc dot gnu dot org
2003-12-02  1:21 ` zack at gcc dot gnu dot org
2003-12-02  1:22 ` pinskia at gcc dot gnu dot org
2003-12-02  1:24 ` zack at gcc dot gnu dot org
2003-12-02  5:23 ` zack at gcc dot gnu dot org
2003-12-02  5:39 ` cvs-commit at gcc dot gnu dot org
2003-12-02  5:43 ` andreast at gcc dot gnu dot org

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).