The following - valid? - program produces an ICE in gfortran.

Full program: http://atom.princeton.edu/donev/Fortran/DLL/dlfcn.f90
(Should be checked after the problem in the snippet below has been fixed.)

END MODULE ISO_C_UTILITIES
                         1
Internal Error at (1):
gfc_basic_typename(): Undefined type

(This snippet compiles with g95 and NAG f95, however, the generated C code of
NAG f95 does not compile with gcc ["In function
'iso_c_utilities_MP_c_f_string': conflicting types for 'strlen'"].)


MODULE ISO_C_UTILITIES
   USE ISO_C_BINDING
   implicit none
   CHARACTER(C_CHAR), DIMENSION(1), SAVE, TARGET, PRIVATE :: dummy_string="?"
CONTAINS
   FUNCTION C_F_STRING(CPTR) RESULT(FPTR)
      TYPE(C_PTR), INTENT(IN) :: CPTR ! The C address
      CHARACTER(KIND=C_CHAR), DIMENSION(:), POINTER :: FPTR
      INTERFACE
         FUNCTION strlen(string) RESULT(len) BIND(C,NAME="strlen")
            USE ISO_C_BINDING
            TYPE(C_PTR), VALUE :: string ! A C pointer
         END FUNCTION
      END INTERFACE
      CALL C_F_POINTER(FPTR=FPTR, CPTR=CPTR, SHAPE=[strlen(CPTR)])
   END FUNCTION
END MODULE ISO_C_UTILITIES


-- 
           Summary: [ISO C Binding] Internal Error: gfc_basic_typename():
                    Undefined type
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 32630
             nThis:


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32797

Reply via email to