gfortran complex/real cast complaint  [SOLVED]

option, parallelism,...

Moderators: fgoudreault, mcote

Forum rules
Please have a look at ~abinit/doc/config/build-config.ac in the source package for detailed and up-to-date information about the configuration of Abinit 8 builds.
For a video explanation on how to build Abinit 7.x for Linux, please go to: http://www.youtube.com/watch?v=DppLQ-KQA68.
IMPORTANT: when an answer solves your problem, please check the little green V-like button on its upper-right corner to accept it.
Locked
mverstra
Posts: 655
Joined: Wed Aug 19, 2009 12:01 pm

gfortran complex/real cast complaint  [SOLVED]

Post by mverstra » Tue Oct 27, 2020 11:43 pm

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"
Matthieu Verstraete
University of Liege, Belgium

User avatar
gmatteo
Posts: 291
Joined: Sun Aug 16, 2009 5:40 pm

Re: gfortran complex/real cast complaint

Post by gmatteo » Wed Oct 28, 2020 4:10 pm

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

vdananic
Posts: 3
Joined: Fri Apr 02, 2021 2:27 pm

Re: gfortran complex/real cast complaint

Post by vdananic » Fri Apr 02, 2021 4:58 pm

gmatteo wrote:
Wed Oct 28, 2020 4:10 pm
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.

User avatar
admin
Site Admin
Posts: 33
Joined: Thu Sep 17, 2009 9:49 am

Re: gfortran complex/real cast complaint

Post by admin » Fri Apr 09, 2021 2:51 pm

Hi,

see for a example with .ac file
viewtopic.php?f=3&t=4453&p=13172&hilit=mismatch#p13172

have you try with

Code: Select all

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

vdananic
Posts: 3
Joined: Fri Apr 02, 2021 2:27 pm

Re: gfortran complex/real cast complaint

Post by vdananic » Sun Apr 11, 2021 11:44 pm

admin wrote:
Fri Apr 09, 2021 2:51 pm
Hi,

see for a example with .ac file
viewtopic.php?f=3&t=4453&p=13172&hilit=mismatch#p13172

have you try with

Code: Select all

./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.

Locked