Hi!

See
http://gcc.gnu.org/ml/fortran/2007-08/msg00336.html
and
http://gcc.gnu.org/ml/fortran/2007-08/msg00338.html

GFortran seems to handle in a slightly surprising way optional empty strings...

Cheers!

Philippe

PS: a testcase from François-Xavier Coudert

  CHARACTER(LEN=1) :: s
  s = " "
  CALL bar (s)
  CALL bar (trim(s))
CONTAINS
  SUBROUTINE bar (s)
    CHARACTER(LEN=*), OPTIONAL :: s
    IF (PRESENT (s)) THEN
      WRITE(*,"(A)") "Argument: |" // s // "|"
    ELSE
      WRITE(*,"(A)") "No argument"
    END IF
  END SUBROUTINE bar
END


-- 
           Summary: Optional empty strings do not appear to be 'PRESENT'
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: P dot Schaffnit at access dot rwth-aachen dot de


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

Reply via email to