This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: getarg and iargc in gcc-4.0.2
On Wed, Dec 07, 2005 at 03:13:03PM -0600, Dr. Germund Hojer wrote:
> Your program compiles correctly both with g77(gcc-3.4.4) and gfortran
> (gcc-4.0.2). The gfortran executable is twice the size. Output is the
> same. Changing iargc for command_argument_count and getarg for
> get_command_argument the program works under gfortran but not under g77.
command_argument_count and get_command_argument are Fortran 2003
intrinsic procedure that have been added to gfortran. These are
not and probably will never be available to g77.
> In the GAMESS code, iargc and getarg work, when compiled with gcc (C code)
> and g77 (Fortran code) and linked with g77. All with gcc-3.4.4 and
> earlier.
g77 does not make a distinction between an intrinsic procedure
that it provides and external procedures that a user may provide.
In other words, libg2c is a polluted name space. libgfortran
tries to keep its namespace clean by prefixing intrinsic
procedures with _gfortran_. This is why you can't find iargc_
and getarg_. I'm aware of two exceptions in libgfortran.
> The same code compiled and linked with gcc and gfortran
> (gcc-4.0.2) give the same error in the linking stage with "undefined
> reference to .." both for the iargc/getarg and the
> command_argument_count/get_command_argument combinations.
> The C code in GAMESS refers to the parallel execution control, while the
> Fortran code refers to the computational chemistry part, which is the main
> part.
In your code, change iargc_ and getarg_ to _gfortran_iargc
and _gfortran_getarg_i4.
Unfortunately, GAMESS isn't available without jumping through
hoops, so there is no incentive to fix its broken code.
--
Steve