Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

I am getting errors in old Fortran codes written in 2014 which is not recognized by current Fortran

Siraj_Jalali
Beginner
681 Views

The errors are ' This name has not been given an explicit type'

I am running someone else's Thermal Desktop\SindaFluint model that is calling in the Fortran codes.

See some of the errors below:

---------------------------------------------------

Current Patch Level = 27
Version = 6.2 Intel Fortran

ifort userLogic.for /I:C:\wissler\modules /warn:declarations /warn:truncated_source /Qopenmp /fpe:0 /real-size:64 /integer-size:64 /names:lowercase /iface:cref "/I:C:\Program Files\Cullimore and Ring\SindaFluint\mod\Current" /MD /iface:mixed_str_len_arg "/include:C:\Program Files\Cullimore and Ring\SindaFluint\lib" /assume:byterecl /extend-source:132 /O3 /traceback /INCREMENTAL:NO

Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.5.0 Build 20211109_000000
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.

userLogic.for(823): warning #6717: This name has not been given an explicit type. [INTCRY]
call splitString(fileName, UCA(intcry(submodelName,100000)))
---------------------------------------^
userLogic.for(863): warning #6717: This name has not been given an explicit type. [INTCRY]
UCA(intcry(submodelName,status))=crew(Person)%status
-----------^
userLogic.for(896): warning #6717: This name has not been given an explicit type. [INTCRY]
crew(Person)%cutfat =UCA(intcry(submodelName,cutfat))
-------------------------------------^
userLogic.for(927): warning #6717: This name has not been given an explicit type. [TCABP]
crew(Person)%asinda(213) = tcabp !TCD 8/16/2013
----------------------------------^
userLogic.for(1024): error #6405: The same named entity from different modules and/or program units cannot be referenced. [PI]
use variablesa, only: ts, tc, twall, pi, rb, xlen=>xl, ctof

----------------------------------------------------------

Seems like variables files not included when program is run.

Is it due to difference in Fortran compilers being used or variables are not included?

The error file is enclosed.

Thanks

0 Kudos
4 Replies
jimdempseyatthecove
Honored Contributor III
666 Views

You have PI defined in two or more modules (or module and common, or, common and common). Fix that. Note, this may present a (new) module (with newer edits defining INTCRY) from being compiled and thus replacing an older module (without INTCRY defined).

 

Barring the above, you have not USE'd a module or otherwise defined INTCRY in userLogic.for.

An older version of Fortran may have implicitly defined INTCRY

If INTCRY (either function or array) is in a module, you must USE ThatModuleNameHere

.AND. remove any EXTERNAL INTCRY from the source.

Note, should INTCRY be contained in a module, and you use IMPLICIT or explicit reference (e.g. EXTERNAL) not via USE, then the link phase will not be able to locate INTCRY (barring explicit ALIAS). IOW the module mangled name is prepended to the symbol name INTCRY.

Jim Dempsey

0 Kudos
Siraj_Jalali
Beginner
606 Views

Thanks for your response, that helped to understand the issues.

I have 14 modules and 3 libraries, 

The modules and libraries were compiled I think using Fortran 90 in 2014, I want to recompile them using current Intel Visual Studio 2022, and replace with existing modules and libraries.  How can I recompile modules and libraries?  These are in *.mod and *.lib formats, cannot be opened by Notepad. 

 

How do I define a function or variable in userLogic.for?

 

I defined intcry as 'F integer :: carrayNo , intcry' in a file WHIGL.inc being included, and few intcry errors got resolved. Also I added tcabp in Thermal Desktop registers and that error got removed.

 

I think these variables and functions are defined in modules and libraries, the current Fortran compiler is not at par with old one.  I am including makinh.txt to describe the compilation.

 

 

0 Kudos
Steve_Lionel
Honored Contributor III
654 Views

You are using /warn:declarations, which acts as if IMPLICIT NONE was specified for each program unit. This will complain if you reference a variable that has not been explicitly declared with a type.

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
581 Views

The *.mod files are output files from the compiler (compiling a Fortran source file). The *.lib files are outputs from the linker linking *.obj files that were output from the Fortran compiler. You will need the source files to re-compile to produce newer versions of the *.mod and *.lib files.

 

Think of a *.mod file as functionally similar to a C++ pre-compiled header.

 

Note, when compiling a single Fortran source, it may contain zero, one, two, or more modules, each with or without contained procedures, optionally together with traditional Fortran procedures (functions and/or subroutines). The Fortran compiler will generate multiple output files: one *.mod file for each defined module (* being replaced with name of module)

!  moduleTest2.f90 

module mod_one
    real :: one
    contains
    subroutine sub_one
        implicit none
        print *,"sub_one"
    end subroutine sub_one
end module mod_one
    
module mod_two
    real :: two
    contains
    subroutine sub_two
        implicit none
        print *,"sub_two"
    end subroutine sub_two
end module mod_two
    
module mod_three
    real :: three
    contains
    subroutine sub_three
        implicit none
        print *,"sub_three"
    end subroutine sub_three
end module mod_three
    
subroutine sub_proc
    use mod_one
    use mod_two
    use mod_three
    implicit none
    print *,"sub_proc"
    call sub_one
    call sub_two
    call sub_three
end subroutine sub_proc
    
program moduleTest2
    implicit none
    print *, 'Hello World'
    call sub_proc
end program moduleTest2

C:\test\moduleTest2\moduleTest2>dir Release /b
BuildLog.htm
moduleTest2.exe
moduleTest2.exe.intermediate.manifest
moduleTest2.obj
mod_one.mod
mod_three.mod
mod_two.mod

Either:

a) One of your Fortran source files contains the named module (potentially different name from the source file), in which case you can edit to your needs, or

b) The *.mod file (and *.lib) is supplied by a 3rd party library, in which case you cannot edit.

 

Jim Dempsey

0 Kudos
Reply