Dear Åke,

I tried what you suggested, and I get the same result. (wrong with EB installed GCC 5+, and good with system GCC)

Sincerely,

Balazs


On 16/02/2018 07:37, Åke Sandgren wrote:
The error is not in the compilers but rather that the common block is in
a module.
To access it you must have a "use" clause in the main code.
I.e.
PROGRAM MAIN
use INITT

Then you don't even have to define the common block in main.

The "EXTERNAL INITT" does nothing in this case, it just says that the
function/subroutine initt is external, but there is no such
function/subroutine and it isn't used either (obviously).


I.e., the correct main_prob.f must in this case be called main_prob.f90
(since it is F90 not F77 code or you have to explicitly tell the
compiler that it is dealing with f90 or at least freeform fortran code)
And should look like

PROGRAM MAIN
use initt

PRINT *,'A =', IA
PRINT *,'B =', IB

END

And of course initt_probe should also be called .f90 since it is F90 not
F77 code.

On 02/15/2018 10:10 PM, Balazs HAJGATO wrote:
Dear Easybuilders,

I have some problems with fortran linking. It looks that certain versions of 
fortran does not look for external block data in libraries. If one specifies 
the object file for the block data then the result is correct.

It seems that gfortran <= 4.8 works correctly, but gfortran >=4.9 not works 
correctly in some cases.

--
HPC consultant
HPC/VSC Support and System Administration
Computing Center
ULB/VUB
Avenue Adolphe Buyllaan 91 - CP 197
1050 Brussels
Belgium

Reply via email to