Compilation error: Argument for c_loc should be pointer or target

Problems running VASP: crashes, internal errors, "wrong" results.

Moderators: Global Moderator, Moderator

Locked
Message
Author
rogeli_grima
Newbie
Newbie
Posts: 1
Joined: Wed Apr 10, 2024 3:13 pm

Compilation error: Argument for c_loc should be pointer or target

#1 Post by rogeli_grima » 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.

michael_wolloch
Global Moderator
Global Moderator
Posts: 69
Joined: Tue Oct 17, 2023 10:17 am

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

#2 Post by michael_wolloch » Thu Apr 11, 2024 7:29 am

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

michael_wolloch
Global Moderator
Global Moderator
Posts: 69
Joined: Tue Oct 17, 2023 10:17 am

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

#3 Post by michael_wolloch » Fri Apr 12, 2024 8:34 am

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!

sergey_lisenkov1
Newbie
Newbie
Posts: 16
Joined: Tue Nov 12, 2019 7:55 am

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

#4 Post by sergey_lisenkov1 » Mon May 13, 2024 7:22 pm

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.

michael_wolloch
Global Moderator
Global Moderator
Posts: 69
Joined: Tue Oct 17, 2023 10:17 am

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

#5 Post by michael_wolloch » Tue May 14, 2024 7:40 am

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

Locked