Fortran Intrinsic Function Names used for Symbols

| SimCon Home | fpt Reference Manual Home |

Can Intrinsic Function Names be Used for Symbols?

Yes they can, and this is necessary because users may declare them to be external and may then replace an intrinsic function with their own routine.

Does this cause a problem?

Yes it can, for two reasons.

Maintainers of a code may be unaware that an intrinsic name has been used for a variable and may try to use it for the intrinsic function itself.

Armed with a cut-and-paste editor, users may move code between routines. The best example we have found had MAX declared as a two dimensional array. The code was moved to a routine which did not use the include file where MAX was declared. It compiled but it didn't work too well.

The fpt Report

fpt always lists the intrinsics used for symbols in the listing file. It also writes this list in response to the command:

SHOW KEYWORDS USED FOR SYMBOLS

This command lists both the keywords and the intrinsics, but in separate tables.

The beginning of the listing for the weather and climate code, WRFV3.4.1 is shown below. Over 300 variables have the same names as intrinsic functions and a few are arrays.

FORTRAN Intrinsic names used for identifiers -------------------------------------------- Name Scope Use/COMMON Address Type Size Value/Bounds ---- ----- ---------- ------- ---- ---- ------------ log esmf_stubs%esmf_logwrite Formal Input Argument esmf_log *4 df clog module_ra_gsfcsw%flxco2 Local REAL *4 df clog module_ra_goddard%reduce_flux Local REAL *8 abs noahmp_routines%surrad Local REAL *4 df dabs module_ra_sw%swpara Local REAL *4 df jint error_function%calerf_r8 Formal Input Argument INTEGER *4 df jint error_function%calerf_r4 Formal Input Argument INTEGER *4 df

Copyright ©1995 to 2017 Software Validation Ltd. All rights reserved.