Seeing these failures only, when libffi is built with --enable-debug, on powerpc-linux only. The bugs remain without the --enable-debug switch, but are not triggered by the testsuite. All failures have the form ASSERTION FAILURE: ../../../src/libffi/src/powerpc/ffi.c line 118 Looking at libffi/include/ffi_common.h, the assertion triggers, if the macro argument is not properly aligned. ffi.c line 118: /* Check that everything starts aligned properly. */ FFI_ASSERT(((unsigned)(char *)stack & 0xF) == 0); The stack should be 16-byte aligned. Probably the wrong one of the multitude of stack alignment macros is being used. Appended is the test-summery of libjava configured with --enable-debug. === libjava tests === Running target unix FAIL: calls run FAIL: martin run FAIL: throwit run FAIL: ArrayStore execution - gij test FAIL: ArrayStore execution - gij test FAIL: ArrayStore2 execution - gij test FAIL: ArrayStore2 execution - gij test FAIL: Array_1 execution - gij test FAIL: Array_1 execution - gij test FAIL: Array_2 execution - gij test FAIL: Array_2 execution - gij test FAIL: Array_3 -O execution - source compiled test FAIL: Class_1 execution - gij test FAIL: Class_1 execution - gij test FAIL: Divide_1 execution - gij test FAIL: Divide_1 execution - gij test FAIL: Float_1 execution - gij test FAIL: Float_1 execution - gij test FAIL: G19990301_01 execution - gij test FAIL: G19990301_01 execution - gij test FAIL: G19990302_02 execution - gij test FAIL: G19990302_02 execution - gij test FAIL: G19990303_01 execution - gij test FAIL: G19990303_01 execution - gij test FAIL: G19990304_01 execution - gij test FAIL: G19990304_01 execution - gij test FAIL: G19990310_01 execution - gij test FAIL: G19990310_01 execution - gij test FAIL: II execution - gij test FAIL: II execution - gij test FAIL: InterfaceDispatch execution - gij test FAIL: InterfaceDispatch execution - gij test FAIL: InvokeReturn execution - source compiled test FAIL: InvokeReturn execution - gij test FAIL: InvokeReturn execution - bytecode->native test FAIL: InvokeReturn -O execution - source compiled test FAIL: InvokeReturn execution - gij test FAIL: InvokeReturn -O execution - bytecode->native test FAIL: Invoke_1 execution - gij test FAIL: Invoke_1 execution - gij test FAIL: Invoke_2 execution - gij test FAIL: Invoke_2 execution - gij test FAIL: KeepInline execution - gij test FAIL: KeepInline execution - gij test FAIL: Matrix4f execution - gij test FAIL: Matrix4f execution - gij test FAIL: N19990310_02 execution - gij test FAIL: N19990310_02 execution - gij test FAIL: N19990310_3 execution - gij test FAIL: N19990310_3 execution - gij test FAIL: N19990310_4 execution - gij test FAIL: N19990310_4 execution - gij test FAIL: N19990310_5 execution - gij test FAIL: N19990310_5 execution - gij test FAIL: PR141 execution - gij test FAIL: PR141 execution - gij test FAIL: PR160 execution - gij test FAIL: PR160 execution - gij test FAIL: PR162 execution - gij test FAIL: PR162 execution - gij test FAIL: PR218 execution - gij test FAIL: PR218 execution - gij test FAIL: PR242 execution - gij test FAIL: PR242 execution - gij test FAIL: PR260 execution - gij test FAIL: PR260 execution - gij test FAIL: PR3731 execution - gij test FAIL: PR3731 execution - gij test FAIL: PR5057 execution - gij test FAIL: PR5057 execution - gij test FAIL: PR5057_2 execution - gij test FAIL: PR5057_2 execution - gij test FAIL: PR6085 execution - gij test FAIL: PR6085 execution - gij test FAIL: PR6204 execution - gij test FAIL: PR6204 execution - gij test FAIL: PR6729 execution - gij test FAIL: PR6729 execution - gij test FAIL: Shazam execution - gij test FAIL: Shazam execution - gij test FAIL: StaticConstructor execution - gij test FAIL: StaticConstructor execution - gij test FAIL: StringBuffer_1 execution - gij test FAIL: StringBuffer_1 execution - gij test FAIL: SyncTest execution - gij test FAIL: SyncTest execution - gij test FAIL: Synch execution - gij test FAIL: Synch execution - gij test FAIL: TLtest execution - gij test FAIL: TLtest execution - gij test FAIL: TestProxy execution - source compiled test FAIL: TestProxy execution - gij test FAIL: TestProxy execution - bytecode->native test FAIL: TestProxy -O execution - source compiled test FAIL: TestProxy execution - gij test FAIL: TestProxy -O execution - bytecode->native test FAIL: Thread_Alive execution - gij test FAIL: Thread_Alive execution - gij test FAIL: Thread_Interrupt execution - gij test FAIL: Thread_Interrupt execution - gij test FAIL: Thread_Join execution - gij test FAIL: Thread_Join execution - gij test FAIL: Thread_Monitor execution - gij test FAIL: Thread_Monitor execution - gij test FAIL: Thread_Sleep execution - gij test FAIL: Thread_Sleep execution - gij test FAIL: Thread_Wait execution - gij test FAIL: Thread_Wait execution - gij test FAIL: Thread_Wait_2 execution - gij test FAIL: Thread_Wait_2 execution - gij test FAIL: Thread_Wait_Interrupt execution - gij test FAIL: Thread_Wait_Interrupt execution - gij test FAIL: Throw_2 execution - gij test FAIL: Throw_2 execution - gij test FAIL: anfi execution - gij test FAIL: anfi execution - gij test FAIL: anon execution - gij test FAIL: anon execution - gij test FAIL: anon2 execution - gij test FAIL: anon2 execution - gij test FAIL: anon3 execution - gij test FAIL: anon3 execution - gij test FAIL: anon4 execution - gij test FAIL: anon4 execution - gij test FAIL: anon_ctor_itf_arg execution - gij test FAIL: anon_ctor_itf_arg execution - gij test FAIL: anonarray execution - gij test FAIL: anonarray execution - gij test FAIL: anonarray2 execution - gij test FAIL: anonarray2 execution - gij test FAIL: direct_read execution - gij test FAIL: direct_read execution - gij test FAIL: direct_write execution - gij test FAIL: direct_write execution - gij test FAIL: err1 execution - gij test FAIL: err1 execution - gij test FAIL: err11 execution - gij test FAIL: err11 execution - gij test FAIL: err12 execution - gij test FAIL: err12 execution - gij test FAIL: err2 execution - gij test FAIL: err2 execution - gij test FAIL: err3 execution - gij test FAIL: err3 execution - gij test FAIL: err4 execution - gij test FAIL: err4 execution - gij test FAIL: err5 execution - gij test FAIL: err5 execution - gij test FAIL: err8 execution - gij test FAIL: err8 execution - gij test FAIL: err9 execution - gij test FAIL: err9 execution - gij test FAIL: final_inner execution - gij test FAIL: final_inner execution - gij test FAIL: final_int execution - gij test FAIL: final_int execution - gij test FAIL: final_static_and_friend execution - gij test FAIL: final_static_and_friend execution - gij test FAIL: indirect execution - gij test FAIL: indirect execution - gij test FAIL: indirect_read execution - gij test FAIL: indirect_read execution - gij test FAIL: indirect_write execution - gij test FAIL: indirect_write execution - gij test FAIL: initexc execution - gij test FAIL: initexc execution - gij test FAIL: initfield execution - gij test FAIL: initfield execution - gij test FAIL: inline execution - gij test FAIL: inline execution - gij test FAIL: inner1 execution - gij test FAIL: inner1 execution - gij test FAIL: inner2 execution - gij test FAIL: inner2 execution - gij test FAIL: inner3 execution - gij test FAIL: inner3 execution - gij test FAIL: inner4 execution - gij test FAIL: inner4 execution - gij test FAIL: inner_array execution - gij test FAIL: inner_array execution - gij test FAIL: inner_interface execution - gij test FAIL: inner_interface execution - gij test FAIL: instance execution - gij test FAIL: instance execution - gij test FAIL: instinit execution - gij test FAIL: instinit execution - gij test FAIL: instinit2 execution - gij test FAIL: instinit2 execution - gij test FAIL: invoke_from_inner execution - gij test FAIL: invoke_from_inner execution - gij test FAIL: invokethrow execution - gij test FAIL: invokethrow execution - gij test FAIL: klass execution - gij test FAIL: klass execution - gij test FAIL: multiple_finit execution - gij test FAIL: multiple_finit execution - gij test FAIL: nested_with_ctor execution - gij test FAIL: nested_with_ctor execution - gij test FAIL: override execution - gij test FAIL: override execution - gij test FAIL: pr133 execution - gij test FAIL: pr133 execution - gij test FAIL: pr179 execution - gij test FAIL: pr179 execution - gij test FAIL: pr6388 execution - gij test FAIL: pr6388 execution - gij test FAIL: pr83 execution - gij test FAIL: pr83 execution - gij test FAIL: pr8415 execution - gij test FAIL: pr8415 execution - gij test FAIL: pr8823 execution - gij test FAIL: pr8823 execution - gij test FAIL: pr8945 execution - gij test FAIL: pr8945 execution - gij test FAIL: private_direct_read execution - gij test FAIL: private_direct_read execution - gij test FAIL: search_outer execution - gij test FAIL: search_outer execution - gij test FAIL: stringconst execution - gij test FAIL: stringconst execution - gij test FAIL: stringconst2 execution - gij test FAIL: stringconst2 execution - gij test FAIL: stub execution - gij test FAIL: stub execution - gij test FAIL: test_long execution - gij test FAIL: test_long execution - gij test FAIL: tmi execution - gij test FAIL: tmi execution - gij test FAIL: tp execution - gij test FAIL: tp execution - gij test FAIL: update_outer execution - gij test FAIL: update_outer execution - gij test FAIL: utilTest execution - gij test FAIL: utilTest execution - gij test FAIL: /home/doko/3.3/gcc-3.3-3.3ds6/build/powerpc-linux/libjava/testsuite/TestEarlyGC.exe execution - /home/doko/3.3/gcc-3.3-3.3ds6/build/powerpc-linux/libjava/testsuite/TestEarlyGC.exe === libjava Summary === # of expected passes 2476 # of unexpected failures 235 # of expected failures 16 # of untested testcases 247 Release: 3.3 20030429 (Debian prerelease) (Debian testing/unstable)
Matthias, is this problem still occurring? Looking at http://gcc.gnu.org/ml/gcc-testresults/2003- 06/msg01159.html , I don't see nearly that many libjava unexpected fails, though there are a lot more expected fails... Thanks, Dara
Most likely still happens (Note the only way to get these failures you have to configure with --enable-debug).
Created attachment 4311 [details] proposed patch (untested) I bet something along this patch will help. I can't bootstrap it anytime soon though.
I can confirm this behavior on mainline gcc-3.4. Built the runtimelibs with --enable-debug. And ran the libjava testsuite. Lots of failures due to this assert. The libffi testsuite has one failure. I guess the testcase itself is not quite correct. Fails also on darwin and solaris9 with --enable-debug. I will investigate further on mainline, the patchlet from franzo not yet tested. Further results will follow.
The patchlet in the attachment does not help since it aligns the aligned bytes and not the so called misaligned stack. Here a snippet from gdb: Breakpoint 1, ffi_prep_args_SYSV (ecif=0x7ffff470, stack=0x7ffff428) at ../../../gcc/libffi/src/powerpc/ffi.c:126 126 FFI_ASSERT(((unsigned long)(char *)stack & 0xF) == 0); 1: x/i $pc 0xfcf5668 <ffi_prep_args_SYSV+152>: andi. r11,r4,15 Current language: auto; currently c (gdb) p ((unsigned long)(char *)stack & 0xF) == 0 $16 = 0 (gdb) p ((unsigned long)(char *)stack & 0x7) == 0 $18 = 1 So I'm investigating here....
The stack gets misagligned here: void ffi_java_raw_call (/*@dependent@*/ ffi_cif *cif, void (*fn)(), /*@out@*/ void *rvalue, /*@dependent@*/ ffi_raw *raw) { void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); <------ Franz has a patch for this: http://gcc.gnu.org/ml/gcc-patches/2003-10/msg02351.html I tested it on mainline and 3.3.3, all, except one fails disapear. The one which I have to investigate is: FAIL: calls run with FFI_ASSERT(copy_space >= (char *)next_arg); ffi.c:256
Subject: Bug 10610 CVSROOT: /cvs/gcc Module name: gcc Changes by: sirl@gcc.gnu.org 2003-10-28 19:46:46 Modified files: gcc/config/rs6000: sysv4.h gcc : ChangeLog Log message: 2003-10-28 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> PR target/11598 PR libgcj/10610 * config/rs6000/sysv4.h (PREFERRED_STACK_BOUNDARY): New macro. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/sysv4.h.diff?cvsroot=gcc&r1=1.139&r2=1.140 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1579&r2=2.1580
Subject: Bug 10610 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: sirl@gcc.gnu.org 2003-10-28 19:55:56 Modified files: gcc/config/rs6000: sysv4.h gcc : ChangeLog Log message: 2003-10-28 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> PR target/11598 PR libgcj/10610 * config/rs6000/sysv4.h (PREFERRED_STACK_BOUNDARY): New macro. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/sysv4.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.113.4.4&r2=1.113.4.5 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.791&r2=1.16114.2.792
Subject: Bug 10610 CVSROOT: /cvs/gcc Module name: gcc Changes by: sirl@gcc.gnu.org 2003-10-28 21:13:40 Modified files: gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.dg: ppc-stackalign-1.c Log message: 2003-10-28 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> PR libgcj/10610 * gcc.dg/ppc-stackalign-1.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/ppc-stackalign-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3152&r2=1.3153
Subject: Bug 10610 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: sirl@gcc.gnu.org 2003-10-28 21:15:18 Modified files: gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.dg: ppc-stackalign-1.c Log message: 2003-10-28 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> PR libgcj/10610 * gcc.dg/ppc-stackalign-1.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/ppc-stackalign-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.311&r2=1.2261.2.312
The alignment bug is fixed so closing as fixed, the last ffi failure is a different bug so file a new PR for that one.