err_bad_typedef.c leads to a call to initialize_aggregate with arg->elemnts==NULL. This sets ptr on line 46 of libffi/src/prep_cif.c to NULL, which is then dereferenced on line 48.
Environment: System: Linux dps 2.6.30.1-nofb #3 SMP PREEMPT Tue Jul 7 13:26:53 BST 2009 x86_64 GNU/Linux Architecture: x86_64 host: x86_64-unknown-linux-gnu build: x86_64-unknown-linux-gnu target: x86_64-unknown-linux-gnu configured with: ../gcc/trunk/configure -C --prefix=/usr --enable-hshared --enab le-languages=c,c++,fortran,java,objc --no-create --no-recursion How-To-Repeat: Run the err_bad_typedef.c test case in the libffi test suite. It is an expected failure. ------- Comment #1 from dps at simpson dot demon dot co dot uk 2009-07-13 20:36 ------- Fix: The following patch turns err_bad_typedef.c test case into an unexpected pass and the pacthed version passes all the tests the current version does. I= am assuming that ptr==NULL is not meant to happen so failure is the appropriate response. --- libffi/src/prep_cif.c.dist 2009-06-04 22:31:11.003714944 +0100 +++ libffi/src/prep_cif.c 2009-07-13 02:00:43.956506574 +0100 @@ -44,6 +44,8 @@ FFI_ASSERT(arg->alignment == 0); ptr = &(arg->elements[0]); + if (ptr == NULL) + return FFI_BAD_TYPEDEF; while ((*ptr) != NULL) { -- Summary: Fix for err_bad_typedef.c libffi test failure Product: gcc Version: 4.3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dps at simpson dot demon dot co dot uk GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40736