dbcsr icon indicating copy to clipboard operation
dbcsr copied to clipboard

Fortran Standard violation in dbcsr_api_c.F

Open SpinTensor opened this issue 2 years ago • 0 comments

In the File dbcsr_api_c.F in the subroutine c_free_string the intrinsic subroutine c_f_pointer is called: CALL c_f_pointer(c_string, string). The second argument is declared as CHARACTER(:, kind=c_char), POINTER :: string. The Fortran standard draft ISO/IEC FDIS 1539-1:2018 section 18.2.3.3 states that the second argument of the c_f_pointer "[...]shall not have the deferred type parameter[...]", which is has in this routine.

Edit: The standard gives (in Case iv) an example of how to deal with pointers with deferred type parameters and how to handle them. I will cite it here so there is no need to look it up:

Character(42), Pointer :: C1
Character(:), Pointer :: C2
Call C_F_Pointer(CPTR, C1)
C2 => C1

SpinTensor avatar Jan 10 '22 11:01 SpinTensor