Gfortran complex/real cast complaint

Hello all,

my new version of gfortran (10.2.0) complains with an error when I compile abinit, due to simultaneous casts that it recognizes passing the same variable (real or complex) to a routine that only expects one of the 2 types (even if the latter is outside its scope, like a lapack/blas call). This is traditional disgusting fortran and BLAS usage, but I can’t get around it.

An example below:

…/…/…/…/…/shared/common/src/28_numeric_noabirule/abi_xhpgv.f90:103:34:

103 | call zhpgv(itype,jobz,uplo,n,a,b,w,z,ldz,eigen_z_work,eigen_z_rwork,info)
| 1

235 | call zhpgv(itype,jobz,uplo,n,a,b,w,z,ldz,work,rwork,info)
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(8)/COMPLEX(8)).

Does anyone know of a flag for gfortran to make it more lenient (like before) or how I can circumvent this without recoding all of the abinit interfaces. Sometimes the calls are side by side, to dcopy and zcopy with the same argument, so impossible to separate, just checking if it is dimensioned with an extra factor of 2 or not…

My flags (pedantic also raises some other issues, so I removed it for the above tests):

FCFLAGS_EXTRA=“-g -Wall -pedantic -funroll-loops -O3 -fgcse-lm -fgcse-sm -ftree-vectorize -fbounds-check -finit-integer=-666 -finit-real=zero -ffree-line-length-0 -I/usr/local/include -mno-avx”

Does anyone know of a flag for gfortran to make it more lenient (like before) or how I can circumvent this without recoding all of the abinit interfaces.

With gfortran > 10, you need to add --fallow-argument-mismatch to your compiler options

That’s what I’m talking about–whatever I do, such as ./configure FCFLAGS=-fallow-argument-mismatch, with
or without quotation marks, whether with or without config file, nothing helps. The option is not passed to mpif90.

Hi,

see for a example with .ac file
https://forum.abinit.org/viewtopic.php?f=3&t=4453&p=13172&hilit=mismatch#p13172

have you try with

./configure ... FCFLAGS_EXTRA="-g -Wall -fallow-argument-mismatch"

Yes, I’ve tried everything mentioned by you and others, and everything else I could imagine.
No flags helped. Finally, I’ve resolved this issue by brute force. When, in the first pass, the script
build-abinit-fallbacks.sh.in finished with error, I’ve done:
cd abinit-fallbacks-9.2/sources/netcdf-fortran-4.5.2/tmp-build/fortran/
and then:
mpifort -I. -g -O2 -w -fallow-argument-mismatch -I/home/vladimir/abinit-9.4.1/tmp/fallbacks/install_fb/gnu/10.2/hdf5/1.10.6/include -I/home/vladimir/abinit-9.4.1/tmp/fallbacks/install_fb/gnu/10.2/netcdf4/4.6.3/include -c -o netcdf4.o …/…/fortran/netcdf4.f90

After that, in the second pass the “build” finished with the error, and the I’ve issued a command

/bin/sh …/libtool --tag=FC --mode=compile mpifort -I. -g -O2 -w -fallow-argument-mismatch -I/home/vladimir/abinit-9.4.1/tmp/fallbacks/install_fb/gnu/10.2/hdf5/1.10.6/include -I/home/vladimir/abinit-9.4.1/tmp/fallbacks/install_fb/gnu/10.2/netcdf4/4.6.3/include -c -o netcdf4.lo …/…/fortran/netcdf4.f90

After that the “build” script finished successfuly, which means that the netcdf4.f90 was the only problematic code,
problematic at least for gcc. The compilation finisted without error, so finally I have the latest version of abinit
installed on my machine.