Compilation error: Argument for c_loc should be pointer or target

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

Moderators: Global Moderator, Moderator

Post Reply
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: 58
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: 58
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!

Post Reply