0

I have a project in which I have a main program main.f95 which uses a bunch of modules: each subroutine called by main.f95 is contained in its own module. I've done this to avoid interface blocks.

There are two additional modules: global.f95 which contains 8 scalar integers declared as parameters, and Param.f95 which contains 33 scalar reals (using NAG working precision, i.e. double). Finally, one of the subroutines mentioned above, Set_Param.f95, assigns values to the scalars declared in Param.f95. This happens right at the beginning of main.f95.

Finally, I'm using the NAG Fortran library (mark 26) and ifort64-18.

I'm getting the following error at compilation (linking?):

Set_param_mod.o: In function `set_param_mod_mp_set_param_':

Set_param_mod.f95:(.text+0x47): relocation truncated to fit:
R_X86_64_PC32 against symbol `param_mp_rho_i_' defined in COMMON
section in Param.o

Set_param_mod.f95:(.text+0x73): relocation truncated to fit:
R_X86_64_PC32 against symbol `param_mp_theta_' defined in COMMON
section in Param.o

Set_param_mod.f95:(.text+0x84): relocation truncated to fit:
R_X86_64_PC32 against symbol `param_mp_delta_k_' defined in COMMON
section in Param.o

Set_param_mod.f95:(.text+0x95): relocation truncated to fit:
R_X86_64_PC32 against symbol `param_mp_delta_i_' defined in COMMON
section in Param.o

Set_param_mod.f95:(.text+0xa6): relocation truncated to fit:
R_X86_64_PC32 against symbol `param_mp_theta_i_' defined in COMMON
section in Param.o

Set_param_mod.f95:(.text+0xb7): relocation truncated to fit:
R_X86_64_PC32 against symbol `param_mp_theta_k_' defined in COMMON
section in Param.o

Set_param_mod.f95:(.text+0xc8): relocation truncated to fit:
R_X86_64_PC32 against symbol `param_mp_c_e_' defined in COMMON section
in Param.o

Set_param_mod.f95:(.text+0xd2): relocation truncated to fit:
R_X86_64_PC32 against symbol `param_mp_wage_' defined in COMMON
section in Param.o

Set_param_mod.f95:(.text+0xde): relocation truncated to fit:
R_X86_64_PC32 against symbol `param_mp_csi_' defined in COMMON section
in Param.o

Set_param_mod.f95:(.text+0xea): relocation truncated to fit:
R_X86_64_PC32 against symbol `param_mp_b1_' defined in COMMON section
in Param.o

Set_param_mod.f95:(.text+0xf6): additional relocation overflows
omitted from the output

If I'm reading this right, the overflow occurs when Set_Param.f95 tries to assign values to the corresponding scalar variables in Param.f95.

Reading up on other threads here and on the Intel developer forum, it would seem like this should only be occurring if I had >2GB of static data (possibly in COMMON blocks, of which I have none; plus, as listed above, my variables get nowhere near 2GB). Furthermore, the main prescriptions given by those threads are:

i) declare all your big arrays allocatable in your main program (which I've done; I have not, however, declared them allocatable in individual subroutines) and

ii) declare all your data in modules (which I've also done)

Some answers mention that the problem might arise with "global" variables, which I'm not sure what they mean by in Fortran, especially because of prescription ii) above.

Given I am pretty lost at this point, I wonder whether the problem stems from having put every subroutine in a separate module, rendering the temporary arrays within "global" in whatever sense that is meant in those other threads?

Any other leads?

francescalus
  • 30,576
  • 16
  • 61
  • 96
DrG
  • 151
  • 1
  • 7
  • Please use tag [tag:fortran] for all Fortran questions. – Vladimir F Героям слава Feb 23 '18 at 10:08
  • Have you searched the error message? https://stackoverflow.com/questions/12916176/gfortran-for-dummies-what-does-mcmodel-medium-do-exactly https://stackoverflow.com/questions/20687170/fortran-array-implementation-error https://stackoverflow.com/questions/10486116/what-does-this-gcc-error-relocation-truncated-to-fit-mean – Vladimir F Героям слава Feb 23 '18 at 10:10
  • Please show your code. Otherwise I must assume your question is a duplicate of the above. You should show it is not the case with a [mcve]. Modules variables are basically global variables. Are there *any* large arrays in your code? Do NOT look just at the specifics of that subroutine. You must consider the **complete** code. All module variables. – Vladimir F Героям слава Feb 23 '18 at 10:14

0 Answers0