[Bug fortran/26728] New: On AMD Athlon 64 not possible to call C routine with variable no. of arguments from Fortran
kbanse at eso dot org
gcc-bugzilla@gcc.gnu.org
Fri Mar 17 15:38:00 GMT 2006
Since gcc release 4 it is not possible anymore to call from Fortran a C routine
defined for a variable no. of arguments using the ellips notation.
It used to work on all previous gcc 3 releases,
and it still works on 32-bit machines, like e.g. Intel Pentium with
SUSE Linux 10.0 (gcc 4.0.2)
$ uname -a
Linux pc012038 2.6.13-15-default #1 Tue Sep 13 14:56:15 UTC 2005 x86_64 x86_64
x86_64 GNU/Linux
$ cat for_ellips.f
PROGRAM FELLIS
WRITE(*,2100)
CALL SSN(99123)
WRITE(*,1100)
STOP 0
1100 FORMAT('F: returning from SSN(n1)')
2100 FORMAT('F: calling SSN(99123)')
END
$ cat ftoc_ellips.c
#include <stdarg.h>
#include <stdio.h>
#define SSN ssn_
int SSN(int *noargs, ...)
{
va_list Cargs;
printf("C: here in SSN...\n");
va_start(Cargs,noargs);
return 0;
}
$ /usr/local/gnu/bin/gfortran -c for_ellips.f
$ /usr/local/gnu/bin/gcc -c ftoc_ellips.c
$ /usr/local/gnu/bin/gfortran for_ellips.o ftoc_ellips.o -o ./ftoc_ellips.exe
$ ./ftoc_ellips.exe
F: calling SSN(99123)
Illegal instruction
$ /usr/local/gnu/bin/gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-threads=posix --prefix=/usr/local/gnu
--with-local-prefix=/usr/local/gnu --infodir=/usr/local/gnu/share/info
--mandir=/usr/local/gnu/share/man --libdir=/usr/local/gnu/lib64
--libexecdir=/usr/local/gnu/lib64 --enable-languages=c,c++,objc,fortran
--disable-checking --with-gxx-include-dir=/usr/local/gnu/include/c++/4.0.2
--disable-libjava-multilib --with-slibdir=/usr/local/gnu/lib64
--with-system-zlib --enable-shared --enable-__cxa_atexit
--without-system-libunwind
Thread model: posix
gcc version 4.1.0
The same happens with gcc 4.0.2:
$ gfortran -c for_ellips.f
$ gcc -c ftoc_ellips.c
$ gfortran for_ellips.o ftoc_ellips.o -o ./ftoc_ellips.exe
$ ./ftoc_ellips.exe
F: calling SSN(99123)
Segmentation fault
$ gcc -v
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,f95,java,ada --disable-checking
--with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-java-awt=gtk
--disable-libjava-multilib --with-slibdir=/lib64 --with-system-zlib
--enable-shared --enable-__cxa_atexit --without-system-libunwind
--host=x86_64-suse-linux
Thread model: posix
gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)
--
Summary: On AMD Athlon 64 not possible to call C routine with
variable no. of arguments from Fortran
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kbanse at eso dot org
GCC build triplet: x86_64-suse-linux
GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26728
More information about the Gcc-bugs
mailing list