The following program is formally valid though the use of of C_CHAR as INTEGER
kind is doubtful and will not work on all systems. (C_CHAR is for CHARACTERS;
there is C_SIGNED_CHAR for INTEGERS, which may or may not have the same kind
number; in gfortran is has.)

However, it is simply a PARAMETER (of value 1) and as an integer of kind=1
exists, it may not be rejected according to the standard. gfortran currently
rejects it. It should print a big warning but it is formally correct.

See also:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/026a820711ab1e70


  use iso_c_binding
  implicit none

  Character(kind=c_char)        :: OK_1
  Integer(  kind=c_signed_char) :: OK_2
  Integer(  kind=c_char)        :: doubtful ! Formally OK, but bad usage

  print *, 'c_char = ', c_char                 ! is 1
  print *, 'c_signed_char = ', c_signed_char   ! is 1
  end


-- 
           Summary: Bind(C): gfortran rejects the questionable but formally
                    correct INTEGER(C_CHAR)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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

Reply via email to