public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libffi/40807]  New: [4.5 Regression] : libffi.call/return_sc.c
@ 2009-07-19 17:05 dave dot korn dot cygwin at gmail dot com
  2009-07-19 17:50 ` [Bug libffi/40807] " dave dot korn dot cygwin at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dave dot korn dot cygwin at gmail dot com @ 2009-07-19 17:05 UTC (permalink / raw)
  To: gcc-bugs

+++ This bug was initially created as a clone of Bug #32843 +++
> 
> On Linux/ia32, this patch
> 
> http://gcc.gnu.org/ml/gcc-cvs/2007-07/msg00336.html
> 
> caused
> 
> FAIL: libffi.call/return_sc.c -O0 -W -Wall execution test
> FAIL: libffi.call/return_sc.c -O2 execution test
> FAIL: libffi.call/return_sc.c -O3 execution test

The fix for this bug broke win32.  The final patch in bug 32843 comment 17:

  http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131343

added support for Darwin by introducing two extended return value types:

> +#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1)
> +#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2)

and code in x86/ffi.c#ffi_prep_cif_machdep to use those types in preference to
equivalent int sizes:

> @@ -142,11 +146,11 @@
>      case FFI_TYPE_STRUCT:
>        if (cif->rtype->size == 1)
>          {
> -          cif->flags = FFI_TYPE_SINT8; /* same as char size */
> +          cif->flags = FFI_TYPE_SMALL_STRUCT_1B; /* same as char size */
>          }
>        else if (cif->rtype->size == 2)
>          {
> -          cif->flags = FFI_TYPE_SINT16; /* same as short size */
> +          cif->flags = FFI_TYPE_SMALL_STRUCT_2B; /* same as short size */
>          }
>        else if (cif->rtype->size == 4)
>          {

... but it didn't add any code in any of the functions in x86/win32.S to handle
the new extended return codes; right now they fall through and get mistaken for
no return value at all.

  I'm working on a patch.  Hmm, looking closer, it seems that win32.S doesn't
handle any of the UINT types either.  Groan.  I guess I'll adapt the jump table
approach as seen in sysv.S/darwin.S and fill out every case.

  I notice that ffi_call_SYSV has to handle all the return types, but not
ffi_closure_SYSV nor ffi_closure_raw_SYSV.  Does anyone know why that is?


-- 
           Summary: [4.5 Regression] : libffi.call/return_sc.c
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libffi
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dave dot korn dot cygwin at gmail dot com
 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=40807


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

* [Bug libffi/40807] [4.5 Regression] : libffi.call/return_sc.c
  2009-07-19 17:05 [Bug libffi/40807] New: [4.5 Regression] : libffi.call/return_sc.c dave dot korn dot cygwin at gmail dot com
@ 2009-07-19 17:50 ` dave dot korn dot cygwin at gmail dot com
  2009-07-20  1:28 ` davek at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dave dot korn dot cygwin at gmail dot com @ 2009-07-19 17:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dave dot korn dot cygwin at gmail dot com  2009-07-19 17:50 -------
(In reply to comment #0)
>   I notice that ffi_call_SYSV has to handle all the return types, but not
> ffi_closure_SYSV nor ffi_closure_raw_SYSV.  Does anyone know why that is?

  To answer my own question: it appears to be an omission, and these functions
should also handle all return types.


-- 


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


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

* [Bug libffi/40807] [4.5 Regression] : libffi.call/return_sc.c
  2009-07-19 17:05 [Bug libffi/40807] New: [4.5 Regression] : libffi.call/return_sc.c dave dot korn dot cygwin at gmail dot com
  2009-07-19 17:50 ` [Bug libffi/40807] " dave dot korn dot cygwin at gmail dot com
@ 2009-07-20  1:28 ` davek at gcc dot gnu dot org
  2009-07-20 14:12 ` davek at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: davek at gcc dot gnu dot org @ 2009-07-20  1:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from davek at gcc dot gnu dot org  2009-07-20 01:27 -------
Taking assignment.


-- 

davek at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |davek at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-07-20 01:27:55
               date|                            |


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


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

* [Bug libffi/40807] [4.5 Regression] : libffi.call/return_sc.c
  2009-07-19 17:05 [Bug libffi/40807] New: [4.5 Regression] : libffi.call/return_sc.c dave dot korn dot cygwin at gmail dot com
  2009-07-19 17:50 ` [Bug libffi/40807] " dave dot korn dot cygwin at gmail dot com
  2009-07-20  1:28 ` davek at gcc dot gnu dot org
@ 2009-07-20 14:12 ` davek at gcc dot gnu dot org
  2009-07-20 14:31 ` davek at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: davek at gcc dot gnu dot org @ 2009-07-20 14:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from davek at gcc dot gnu dot org  2009-07-20 14:11 -------
Created an attachment (id=18229)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18229&action=view)
proposed fix

  This patch fixes all the significant FAILs currently extant in the libffi
testsuite.

                === libffi Summary ===

# of expected passes            1642
# of unexpected failures        2
# of expected failures          10

  The remaining two FAILs I see:

FAIL: libffi.call/cls_align_pointer.c (test for excess errors)
FAIL: libffi.call/huge_struct.c (test for excess errors)

... are format string warnings of less importance.

I have to go AFK for a bit now so I won't get to submit this until tomorrow
sometime.  Just in case I get hit by a meteorite, here it is for the record.


-- 


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


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

* [Bug libffi/40807] [4.5 Regression] : libffi.call/return_sc.c
  2009-07-19 17:05 [Bug libffi/40807] New: [4.5 Regression] : libffi.call/return_sc.c dave dot korn dot cygwin at gmail dot com
                   ` (2 preceding siblings ...)
  2009-07-20 14:12 ` davek at gcc dot gnu dot org
@ 2009-07-20 14:31 ` davek at gcc dot gnu dot org
  2009-07-20 14:44 ` davek at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: davek at gcc dot gnu dot org @ 2009-07-20 14:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from davek at gcc dot gnu dot org  2009-07-20 14:31 -------
Created an attachment (id=18230)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18230&action=view)
Updated patch

Now with a trivial tweak to fix a missing-prototype warning.


-- 

davek at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #18229|0                           |1
        is obsolete|                            |


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


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

* [Bug libffi/40807] [4.5 Regression] : libffi.call/return_sc.c
  2009-07-19 17:05 [Bug libffi/40807] New: [4.5 Regression] : libffi.call/return_sc.c dave dot korn dot cygwin at gmail dot com
                   ` (3 preceding siblings ...)
  2009-07-20 14:31 ` davek at gcc dot gnu dot org
@ 2009-07-20 14:44 ` davek at gcc dot gnu dot org
  2009-07-24 10:12 ` davek at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: davek at gcc dot gnu dot org @ 2009-07-20 14:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from davek at gcc dot gnu dot org  2009-07-20 14:43 -------
Created an attachment (id=18231)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18231&action=view)
final spin

Turns out that '#' makes a bad choice of comment introducer if the next word is
"if" and you're running your .S file through the C preprocessor!


-- 

davek at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #18230|0                           |1
        is obsolete|                            |


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


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

* [Bug libffi/40807] [4.5 Regression] : libffi.call/return_sc.c
  2009-07-19 17:05 [Bug libffi/40807] New: [4.5 Regression] : libffi.call/return_sc.c dave dot korn dot cygwin at gmail dot com
                   ` (4 preceding siblings ...)
  2009-07-20 14:44 ` davek at gcc dot gnu dot org
@ 2009-07-24 10:12 ` davek at gcc dot gnu dot org
  2009-07-24 10:23 ` davek at gcc dot gnu dot org
  2010-03-23  1:57 ` davek at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: davek at gcc dot gnu dot org @ 2009-07-24 10:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from davek at gcc dot gnu dot org  2009-07-24 10:12 -------
Subject: Bug 40807

Author: davek
Date: Fri Jul 24 10:12:16 2009
New Revision: 150042

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150042
Log:
        PR libffi/40807
        * src/x86/ffi.c (ffi_prep_cif_machdep): Also use sign/zero-extending
        return types for X86_WIN32.
        * src/x86/win32.S (_ffi_call_SYSV): Handle omitted return types.
        (_ffi_call_STDCALL, _ffi_closure_SYSV, _ffi_closure_raw_SYSV,
        _ffi_closure_STDCALL): Likewise.

        * src/closures.c (is_selinux_enabled): Define to const 0 for Cygwin.
        (dlmmap, dlmunmap): Also use these functions on Cygwin.


Modified:
    trunk/libffi/ChangeLog
    trunk/libffi/src/closures.c
    trunk/libffi/src/x86/ffi.c
    trunk/libffi/src/x86/win32.S


-- 


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


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

* [Bug libffi/40807] [4.5 Regression] : libffi.call/return_sc.c
  2009-07-19 17:05 [Bug libffi/40807] New: [4.5 Regression] : libffi.call/return_sc.c dave dot korn dot cygwin at gmail dot com
                   ` (5 preceding siblings ...)
  2009-07-24 10:12 ` davek at gcc dot gnu dot org
@ 2009-07-24 10:23 ` davek at gcc dot gnu dot org
  2010-03-23  1:57 ` davek at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: davek at gcc dot gnu dot org @ 2009-07-24 10:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from davek at gcc dot gnu dot org  2009-07-24 10:22 -------
Fixed at r.150042.


-- 

davek at gcc dot gnu dot org changed:

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


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


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

* [Bug libffi/40807] [4.5 Regression] : libffi.call/return_sc.c
  2009-07-19 17:05 [Bug libffi/40807] New: [4.5 Regression] : libffi.call/return_sc.c dave dot korn dot cygwin at gmail dot com
                   ` (6 preceding siblings ...)
  2009-07-24 10:23 ` davek at gcc dot gnu dot org
@ 2010-03-23  1:57 ` davek at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: davek at gcc dot gnu dot org @ 2010-03-23  1:57 UTC (permalink / raw)
  To: gcc-bugs



-- 

davek at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.5.0


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


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

end of thread, other threads:[~2010-03-23  1:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-19 17:05 [Bug libffi/40807] New: [4.5 Regression] : libffi.call/return_sc.c dave dot korn dot cygwin at gmail dot com
2009-07-19 17:50 ` [Bug libffi/40807] " dave dot korn dot cygwin at gmail dot com
2009-07-20  1:28 ` davek at gcc dot gnu dot org
2009-07-20 14:12 ` davek at gcc dot gnu dot org
2009-07-20 14:31 ` davek at gcc dot gnu dot org
2009-07-20 14:44 ` davek at gcc dot gnu dot org
2009-07-24 10:12 ` davek at gcc dot gnu dot org
2009-07-24 10:23 ` davek at gcc dot gnu dot org
2010-03-23  1:57 ` davek 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).