gfortran -frecord-marker and linking with g++

Ian Lance Taylor iant@google.com
Tue Jan 13 15:26:00 GMT 2009


"Christian Ott" <blowingupstars@gmail.com> writes:

> more than a months ago I ran in to the problem described
> in the following. Back then, I did not get any responses on gcc-help.
> I am not sure if this was because of flaws in my description of the
> problem or because gcc-help is not the right place to ask the particular
> questions I was asking.

gcc-help is a good place to ask, but I suspect that the problem is
simply that nobody knows.  We're mostly C/C++ people here.

You can also ask questions at fortran@gcc.gnu.org, and that may be a
better place for Fortran specific issues.  See
http://gcc.gnu.org/wiki/GFortran .


> I work with a code that uses both c++ and fortran, hence I compile
> with g++ (4.3.2) and gfortran (4.3.2) and link with g++ (4.3.2). For some
> old unformatted fortran files, I need to use -frecord-marker=8 with gfortran.
> This  works beautifully when compiling and linking (a standalone code) with
> gfortran. However, when wrapping a fortran routine in c++ and linking with
> g++,  -frecord-marker=8 is disregarded and the executable assumes the
> standard record marker position.

I took a quick look at the compiler source code, and it appears that
-frecord-marker is implemented by automatically inserting a function
call into the main program.  That means that it will only work for you
if you compile the main function in Fortran, not C++.  I have no idea
whether this is a bug, a misfeature, or working as intended.

Ian



More information about the Gcc-help mailing list