Page 1 of 1

Compilation error: Argument for c_loc should be pointer or target

Posted: Wed Apr 10, 2024 3:37 pm
by rogeli_grima
I am trying to compile VASP 6.4.3 with ELPA support using gcc (GCC) 11.3.1. I get two errors during the compilation of scala.F:
2087 | CALL c_f_pointer(c_loc(A(1)),EP,[NP,NQ])
Error: Argument X at (1) to C_LOC shall have either the POINTER or the TARGET attribute
2088 | CALL c_f_pointer(c_loc(Z),EZ,[NP,NQ])
Error: Argument X at (1) to C_LOC shall have either the POINTER or the TARGET attribute
According to the standar:
C_LOC(X) determines the C address of the argument.
X: Shall have either the POINTER or TARGET attribute. It shall not be a coindexed object. It shall either be a variable with interoperable type and kind type parameters, or be a scalar, nonpolymorphic variable with no length type parameters.
I solved the problem by adding the target attribute to matrices A and Z at src/scala.F lines 2236 and 2252.

Re: Compilation error: Argument for c_loc should be pointer or target

Posted: Thu Apr 11, 2024 7:29 am
by michael_wolloch
Dear rogeli_grima,

thanks for the bug report. Can you post your toolchain and makefile.include, so I can try to reproduce this behavior better?

Cheers, Michael

Re: Compilation error: Argument for c_loc should be pointer or target

Posted: Fri Apr 12, 2024 8:34 am
by michael_wolloch
Hi again.

I was able to reproduce the bug with GCC 11.2. We had previously tested ELPA only with the NVIDIA Fortran compiler, which seems to be more generous than GCC concerning pointer and target attributes.

Your fix is correct, and we will implement it.

Thanks again for reporting the bug in great detail!

Re: Compilation error: Argument for c_loc should be pointer or target

Posted: Mon May 13, 2024 7:22 pm
by sergey_lisenkov1
rogeli_grima wrote: Wed Apr 10, 2024 3:37 pm I am trying to compile VASP 6.4.3 with ELPA support using gcc (GCC) 11.3.1. I get two errors during the compilation of scala.F:
2087 | CALL c_f_pointer(c_loc(A(1)),EP,[NP,NQ])
Error: Argument X at (1) to C_LOC shall have either the POINTER or the TARGET attribute
2088 | CALL c_f_pointer(c_loc(Z),EZ,[NP,NQ])
Error: Argument X at (1) to C_LOC shall have either the POINTER or the TARGET attribute
According to the standar:
C_LOC(X) determines the C address of the argument.
X: Shall have either the POINTER or TARGET attribute. It shall not be a coindexed object. It shall either be a variable with interoperable type and kind type parameters, or be a scalar, nonpolymorphic variable with no length type parameters.
I solved the problem by adding the target attribute to matrices A and Z at src/scala.F lines 2236 and 2252.
can you please post your fix? Thanks.

Re: Compilation error: Argument for c_loc should be pointer or target

Posted: Tue May 14, 2024 7:40 am
by michael_wolloch
Dear Sergey Lisenkov,

The fix is already included in the original post. You have to add the "TARGET" attribute to the matrices A and Z in SUBROUTINE PDSYEVX_ZHEEVX_DESC in src/scala.F
Change

Code: Select all

GDEF    A(:)            !< input/output matrix
to

Code: Select all

GDEF, TARGET :: A(:)    !< input/output matrix
and

Code: Select all

GDEF, ALLOCATABLE ::     Z(:)
to

Code: Select all

GDEF, ALLOCATABLE, TARGET ::     Z(:)
These changes are merged into our master branch and will be in the next release. I have updated the known issues list on the wiki to reflect this.

Cheers, Michael