This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/36759] New: C_LOC and characters greater then one in length.


When I compile the code:

PROGRAM main
  USE, INTRINSIC :: ISO_C_BINDING
  IMPLICIT NONE
  CHARACTER(LEN=2), TARGET :: arg1 = '12'
  TYPE(c_ptr) :: A
  A = c_loc(arg1)
END PROGRAM main

I get the error: 

  A = c_loc(arg1)
           1
Error: CHARACTER argument 'arg1' to 'c_loc' at (1) must have a length of 1

I'm not sure where this restriction comes from (it's not part of the standard).
All the other fortran compilers (at least g95, ifort, and pgf90) support
character LEN >1. Actually they support CHARACTER(LEN=*) when declared in a
subroutine.


-- 
           Summary: C_LOC and characters greater then one in length.
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: brtnfld at hdfgroup dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]