https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125417

            Bug ID: 125417
           Summary: [17 regression] 64-bit x86 tests FAIL on
                    32-bit-default target
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libffi
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: pietro at gcc dot gnu.org
  Target Milestone: ---
            Target: i?86-*-*

The recent libffi 3.5.2 import completely broke 64-bit testing in multilibbed
32-bit x86 targets: all tests FAIL while the 32-bit tests still PASS.  The
failures are like 

FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -fno-diagnostics-color
-DDGTEST=1 -Wno-unused-variable -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-uninitialized -O0 execution test

All tests abort like

Program received signal SIGABRT, Aborted.
0x00007ffff7d6795c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0  0x00007ffff7d6795c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff7d12cc2 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff7cfb4ac in abort () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x0000000000404e80 in void_tests ()
    at
/vol/gcc/src/hg/master/local/libffi/testsuite/libffi.bhaible/test-call.c:115
#4  0x0000000000404fc8 in main ()
    at
/vol/gcc/src/hg/master/local/libffi/testsuite/libffi.bhaible/test-call.c:1735

The abort happens here:

Breakpoint 2, ffi_prep_cif (cif=0x7fffffffe170, abi=FFI_FIRST_ABI, nargs=0, 
    rtype=0x408f90 <ffi_type_void>, atypes=0x0)
    at /vol/gcc/src/hg/master/local/libffi/src/prep_cif.c:222
222       return ffi_prep_cif_core(cif, abi, 0, nargs, nargs, rtype, atypes);
(gdb) s
ffi_prep_cif_core (cif=0x7fffffffe170, abi=FFI_FIRST_ABI, isvariadic=0, 
    nfixedargs=0, ntotalargs=0, rtype=0x408f90 <ffi_type_void>, atypes=0x0)
    at /vol/gcc/src/hg/master/local/libffi/src/prep_cif.c:116
116       unsigned bytes = 0;
(gdb) n
124       if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI))
(gdb) 
125         return FFI_BAD_ABI;

I could ultimately trace this to an upstream change as reported in
https://github.com/libffi/libffi/pull/923/changes/4bff3825a1ab656b649b471eb1a65f95f3322a5a#r3288989552

The 64-bit tests incorrectly use the 32-bit headers, so the caller's and
calles's
ideas of the various FFI_*_ABI values differ: the caller uses the 32-bit
values from ../include while the callee correctly uses the 64-bit values.

Reply via email to