Optional (empty) string argument

Philippe Schaffnit P.Schaffnit@access.rwth-aachen.de
Wed Aug 15 13:23:00 GMT 2007


Hi!

It is filed as 33079 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33079)

Thanks!

Philippe

François-Xavier Coudert wrote:
> 
> I think that's a bug, and it also appears with only one level of
> indirection, by using a non-parameter string:
> 
>   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
> 
> $ gfortran o.f90 && ./a.out
> Argument: | |
> No argument
> 
> Can you file a PR about this, and CC me?
> 
> Thanks,
> FX



More information about the Fortran mailing list