REAL(c_double) matches "double" and is OK. However, COMPLEX(c_double) is invalid as the proper kind parameter is c_double_complex matching "double _Complex" Internally, both yield the same value and also sizeof(0.0_c_double) and sizeof(real(cmplx(0.0, c_double_cmpl)) is the same. Thus one could simply accept c_double as synonym for c_double_complex. gfortran, however, has checks build in which ensure the right KIND is used; there is room for improvement however: ! ------------------------------ use iso_c_binding implicit none real(c_double) :: r complex(c_double) :: c ! << Wrong type(c_ptr) :: ptr ptr = c_loc(c) ! <<< ERROR here end ! ------------------------------ Error: C kind parameter is for type REAL but symbol 'c' at (1) is of type COMPLEX Expected: The error is printed in the "COMPLEX(c_double)" line and not in the "c_loc" line. The other question is whether a WARNING is enough or whether one wants to have an ERROR. PS: Found at http://www.lrz-muenchen.de/services/software/mathematik/gsl/fortran/README " - gfortran 4.3.x does not support complex(c_double)."
First, these are now warnings conditional on -Wc-bind-type (enabled by -Wall). Also, real and complex kinds are now treated as equivalent for this purpose. Has been so since gfortran 4.4, so I'm closing this PR.