This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] PATCH: Fix omitted optional CHARACTER arguments
- From: Paul Brook <paul at codesourcery dot com>
- To: fortran at gcc dot gnu dot org
- Cc: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>,patch <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 3 Jun 2004 22:39:53 +0100
- Subject: Re: [gfortran] PATCH: Fix omitted optional CHARACTER arguments
- Organization: CodeSourcery
- References: <40BF6968.6040709@physik.uni-muenchen.de>
> 2004-06-03 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
>
> * gfortran.h (gfc_actual_arglist): New field missing_arg_type.
> * interface.c (compare_actual_formal): Keep type of omitted
> optional arguments.
> * trans-expr.c (gfc_conv_function_call): Add string length
> argument for omitted string argument.
Ok. Please also add a a testcase. Maybe something like the following.
Paul
! Test optional character arguments. We still need to pass a string
! length for the absent arguments
program optional_string_1
implicit none
call test(1, "test");
call test(2, c=42, b="Hello World")
contains
subroutine test(i, a, b, c)
integer :: i
character(len=4), optional :: a
character(len=*), optional :: b
integer, optional :: c
if (i .eq. 1) then
if (a .ne. "test") call abort
else
if (b .ne. "Hello World") call abort
if (c .ne. 42) call abort
end if
end subroutine
end program