https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102727
Bug ID: 102727 Summary: Warning for guaranteed interoperable type kind Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: jahns at dkrz dot de Target Milestone: --- Created attachment 51594 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51594&action=edit Source file to reproduce the unexpected interop warning. Compiling a source like the following (also attached) gives a warning with -Wc-binding-type active: SUBROUTINE fwrap(another_int) IMPLICIT NONE INTEGER, INTENT(in) :: another_int ENUM, BIND(c) ENUMERATOR :: enu_a, enu_b END ENUM INTEGER, PARAMETER :: enu_type_kind = KIND(enu_a) INTERFACE SUBROUTINE wrapped_c(enu) BIND(C, name='wrapped_c') IMPORT:: enu_type_kind INTEGER(enu_type_kind), VALUE :: enu END SUBROUTINE wrapped_c END INTERFACE IF (another_int < 0_enu_type_kind .OR. & another_int > enu_b) & CALL abort() CALL wrapped_c(INT(another_int, enu_type_kind)) END SUBROUTINE fwrap $ gfortran -c -o enum-warn.o -Wall -Wextra -Wconversion -Wstrict-overflow enum-warn.f90 enum-warn.f90:9:28: 9 | SUBROUTINE wrapped_c(enu) BIND(C, name='wrapped_c') | 1 Warning: Variable 'enu' at (1) is a dummy argument of the BIND(C) procedure 'wrapped_c' but may not be C interoperable [https://gcc.gnu.org/onlinedocs/gfortran/Error-and-Warning-Options.html#index-Wc-binding-type-Wc-binding-type] I also tried to change the interface block to INTERFACE SUBROUTINE wrapped_c(enu) BIND(C, name='wrapped_c') IMPORT:: enu_a INTEGER(KIND(enu_a)), VALUE :: enu END SUBROUTINE wrapped_c END INTERFACE but that didn't seem to change anything. This is on linux x86_64 with a compiler built with default spack configurations applied. I can dig up more details if required. The stackoverflow discussion leading to this report is at <https://stackoverflow.com/questions/69546068>