With svn revision 116324, on x86_64-unknown-linux-gnu: [EMAIL PROTECTED]:~]$ cat test.c #include <stdio.h> #include <stdarg.h>
void test_(int *test, ...) { printf("test: %d\n", *test); return; } [EMAIL PROTECTED]:~]$ cat forttest.F90 program test_printf call test(-1, 'd') call test(-1, 'd') end program test_printf [EMAIL PROTECTED]:~]$ make gcc -c -o test.o test.c gfortran -c -o forttest.o forttest.F90 gfortran -o test test.o forttest.o [EMAIL PROTECTED]:~]$ ./test test: -1 Illegal instruction [EMAIL PROTECTED]:~]$ This does not happen if void test_(int *test, ...) is replaced with void test_(int *test, char *d) so it appears there's something wrong with variable numbers of arguments being passed between fortran and C. Here's what gdb says: Breakpoint 1, test_ (test=0x400878) at test.c:6 6 printf("test: %d\n", *test); (gdb) n test: -1 8 } (gdb) nexti 0x000000000040070e in test_ (test=0x400874) at test.c:8 8 } (gdb) nexti MAIN__ () at forttest.F90:4 4 call test(-1, 'd') Current language: auto; currently fortran (gdb) nexti 0x0000000000400741 4 call test(-1, 'd') (gdb) nexti 0x0000000000400746 4 call test(-1, 'd') (gdb) nexti 0x000000000040074b 4 call test(-1, 'd') (gdb) nexti Program received signal SIGILL, Illegal instruction. 0x00000000004006ca in test_ (test=0x400878) at test.c:5 5 { Current language: auto; currently c (gdb) but I don't know enough about assembly to help any more. -- Summary: C/Fortran interoperability: variable number of arguments passed from fortran to C causes Illegal instruction Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: cyan+gcc at compsoc dot nuigalway dot ie 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=28818