times-software / feff10

Other
24 stars 14 forks source link

GFortran 10+ Errors #4

Open HaoZeke opened 3 years ago

HaoZeke commented 3 years ago

For Gnu Fortran compilers from version 10 onwards, argument mismatches are treated as errors by default.

This means that if :

gfortran --version | head -n 1 | awk -F ' ' '{print $NF}'
# 10.3.0
# 11.1.0

returns a version greater than 10; you will be greeted with:

m_thermal_scf.f90:346:26:

  329 |       call par_bcast_double(xmunew, 1, 0)
      |                            2
......
  346 |     call par_bcast_double(xnmues, (lx+1)*(nphx+1), 0)
      |                          1
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-2)
m_thermal_scf.f90:347:26:

  329 |       call par_bcast_double(xmunew, 1, 0)
      |                            2
......
  347 |     call par_bcast_double(rhoval, 251*(nphx+1), 0)
      |                          1
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-2)
make[1]: *** [Makefile:457: POT/m_thermal_scf.o] Error 1
make[1]: Leaving directory '$HOME/Git/Github/Fortran/feff10/src'
make: *** [Makefile:171: all] Error 2

An easy workaround is simply:

87c87
> FLAGS = -ffree-line-length-none -mcmodel=medium -march=native -O2 -fallow-argument-mismatch
---
< FLAGS = -ffree-line-length-none -mcmodel=medium -march=native -O2

Basically -fallow-argument-mismatch needs to be added to the Compiler.mk.

This is a workaround and not a fix.

The fix is to follow the error and ensure the right arguments are passed throughout. Will open a PR soon.