missing optional params..

Paul Thomas paulthomas2@wanadoo.fr
Wed Aug 16 10:14:00 GMT 2006


Christopher,

Yes, you are right.  Look at this:

[prt@localhost prs]# cat test.f90
  real :: z = 1.0
  call foo ()
  call foo (z)
contains
  subroutine foo (x)
    real, optional :: x
    if (present(x)) x = 2.0 * x
  end subroutine foo
[prt@localhost prs]# /svn-4.2/bin/gfortran -fdump-tree-original test.f90f90
[prt@localhost prs]# cat test*nal
foo (x)
{
  if (x != 0B)
    {
      *x = *x * 2.0e+0;
    }
  else
    {
      (void) 0;
    }


MAIN__ ()
{
  static real4 z = 1.0e+0;
  static void foo (real4 *);

  _gfortran_set_std (70, 127, 0);
  foo (0B);
  foo (&z);
}

Best regards

Paul



More information about the Fortran mailing list