Variable argument call does not work on 64-bit gfortran
Tobias Burnus
burnus@net-b.de
Mon May 31 18:58:00 GMT 2010
Bob Deen wrote:
> I have a very large legacy Fortran system that is riddled with calls
> to variadic (stdarg) C routines. I know this is not a good idea, is
> not supported, is platform/compiler specific, etc.
> % gfortran yyy.f xxx.c
> % ./a.out
> Segmentation fault
>
> This fails on my current target platform (gfortran 4.1.3, Red Hat
> Enterprise 5.5, 64-bit architecture).
With all the caveats with you mentioned: If I try your program on my
x86-64 Linux, I get the same "Segmentation fault" with 4.1.2 20070115;
however, all my 4.2, 4.3, 4.4, 4.5, and 4.6 compiler work (including
-flto -fwhole-program, -fwhole-file). However, I could not find anything
in the release notes, which indicates a change, cf.
http://gcc.gnu.org/gcc-4.2/changes.html, thus, I do not know why it now
works and how stable it is.
> I'm also okay with moving to gfortran 4.4 if that would help
It seems as if it would help. I think 4.4 is also a good choice: It is a
still supported version [4.3.x is also supported, but essentially no
longer maintained] - using 4.5.0 would be an alternative, unless, you
want to try the currently developed 4.6.
See also: http://gcc.gnu.org/wiki/GFortranBinaries
However, since you have RHEL, I think you can also since 5.4 install
"gcc44" as technical preview. (Or use a distribution, which comes with a
newer GCC by default ;-)
Tobias
More information about the Fortran
mailing list