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

Fortran IA-32, Version 13.1.2.190: Using EQUIVALENCE*s : Link-Error

Ute_P_
Beginner
954 Views

The Software is implemented with MODULE and USE's  And Interrfaces To C. The software ist ported from Compaq Compiler to Intel Compiler. 1 Module is implemented with EQUIVALENCES.
Fortran  is compiling  all Sources, but Linker cannot link, for each Equivalence linker say e.g. : error LNK2001: Nicht aufgelöstes externes Symbol "_GLOBALTAB_mp_IVCARD". (  for all 164 Equivalence's).
Sometimes a  Variable will be found in several sources.
I created a Testproject  only with three MOULE's , only using a few EQUIVALENCE Variables in 2 additional  Example-Sources, then the linker is linking.
I mean there is a bug in Compiler and/or Linker.

eg:

      INTEGER(4) IVCLD (10)
      INTEGER(4) IVSATZ         
      INTEGER(4) IVTYPE         
      INTEGER(4) IVCARD       
      EQUIVALENCE (IVCLD  (   1) , IVANZ          )
      EQUIVALENCE (IVCLD  (   2) , IVSATZ         )
      EQUIVALENCE (IVCLD  (   3) , IVTYPE         )
      EQUIVALENCE (IVCLD  (   4) , IVCARD         )

I Hope you can help me

Kind Regards
 Ute Pelkmann

0 Kudos
5 Replies
Steven_L_Intel1
Employee
954 Views

We need more information. Are you able to provide us a complete test case that shows the problem? Do you declare any of the equivalenced variables PRIVATE? Is the reference coming from a C object or Fortran? Please attach a ZIP of the .obj file from the module and of an object that is referencing the variable that was not found.

I know of an issue we had earlier with equivalenced module variables that were declared PRIVATE, but that was fixed in 13.0.

Lastly, please try a current compiler (16.0.1)

0 Kudos
Ute_P_
Beginner
954 Views

All is public

The variables are only used in Fortran Modules.

I will  attach the buildlog-htm, the Module globaltab , gruppe and Konstante (last two used in globaltab)

Globaltab is the source with EQUIVALENCE's

I cannot send the whole project  with 268 Modules.

I need this Compiler version and VS2008 also uin the future.

Additionally I have installed VS 2012, but without the Fortran Compiler.

In the moment I have no time to Install an new Compiler Version

I had built a testproject with  the 3 Module in intel.zip and  the Modules  in intel2.zip, This testproject  was ok.

I hope you have a idea for me.

Kind regards

Ute Pelkmann

0 Kudos
mecej4
Honored Contributor III
954 Views

I made up some tests and the results from them may shed some light on what may have been happening.

Given this test program:

module tst
implicit none
integer AVAR, BVAR, iAVAR,iBVAR
equivalence (AVAR,iAVAR), (BVAR,iBVAR)
end module

program consume
use tst,only : iBVar,BVAR
implicit none
iBVar=2                  
write(*,*)iBVar*BVar
end

I compiled and dumped the symbols from the OBJ file to obtain this using CVF 6.6 (parts removed for clarity):

018 00000000 SECT1  notype ()    External     | _MAIN__
019 00000000 SECT4  notype       External     | _TST%BVAR
01A 00000000 SECT4  notype       External     | _TST_mp_IBVAR
01B 00000000 SECT4  notype       External     | _TST_mp_BVAR
01C 00000008 SECT4  notype       External     | _TST%AVAR
01D 00000008 SECT4  notype       External     | _TST_mp_IAVAR
01E 00000008 SECT4  notype       External     | _TST_mp_AVAR
01F 00000000 SECT1  notype ()    External     | _CONSUME

Repeating the exercise with IFort 16 gave:

002 00000000 SECT1  notype ()    External     | _TST$
003 00000005 SECT1  notype ()    External     | _MAIN__
004 00000008 UNDEF  notype       External     | _TST_mp_BVAR

There are two classes of differences:

  1. CVF puts outs two symbols for for each EQUIVALENCEd pair of variable names, IFort puts out only the first member of the pair.
  2. Even with /Od, IFort removes unused symbols, whereas CVF puts out unused symbols even with /opt:3

These differences should not matter as long as you do not mix CVF and IFort generated objects and libraries at link time.

I suspect that you have a few CVF generated objects/libraries still around that are being used at link time in your large project.

Further complications that may exist in your large project: equivalenced variables may be used in DATA and COMMON statements.

You may note the somewhat silly ONLY clause, in which two variables seem to be listed. If one of the two is removed from the clause, the compiler rejects the program, which means that USE association is not automatically extended to unlisted EQUIVALENCEd siblings. More reasons for EQUIVALENCE being deprecated.

0 Kudos
Heinz_B_Intel
Employee
954 Views

For the Intel colleagues:  We have this as a case in Premier Support as well (6000149095)

0 Kudos
Heinz_B_Intel
Employee
954 Views

For those who might find this thread by searching for a solution of a similar problem:  The issue ( linking error) could be duplicated for the compiler of the user ( 13.1.2) but is fixed in the latest compiler ( 16.0.1). Not sure when exactly the fix was added however.

For the older compilers, a workaround is not to use /Zi  ( which is implied by  /debug:full  ) or to avoid the  "ONLY" limitation for USE imports of the modules  containing the EQUIVALENCE definitions.

 

0 Kudos
Reply