title: FORTRAN 95: OPTIONAL statement does not work (using FTN95 and Plato)
body: <p>I am having a problem with the <code>OPTIONAL</code> statement in functions and subroutines with Fortran 95. Currently I am using Silverfrost's Plato and their FTN95 compiler (in "Release Win32" mode). After trying to implement the OPTIONAL statement in a more complex program I am writing, I created a very simple program to test it. Here is the code:</p>
  
  <pre><code>program TEST
  
  implicit none
  integer :: a=1, b=2
  
  call Z(a,b)
  call Z(a)
  call Z(b)
  
  end program TEST
  
  subroutine Z(x,y)
  implicit none
  integer :: x
  integer, optional :: y
  
  if (present(y)) then
    write(*,*) x, y
    else
      write(*,*) x
  endif
  
  end subroutine Z
  </code></pre>
  
  <p>I expected the following result displayed on the screen:</p>
  
  <pre><code>1 2
  1
  2
  </code></pre>
  
  <p>Well, the code compiles, although I get a warning (673) that "SUBROUTINE Z has been called with too few arguments". After executing it, I get on my screen:</p>
  
  <pre><code>1 2
  </code></pre>
  
  <p>and then an "Access violation" error message. Can somebody understand what is wrong here?</p>
  
  <p>Thanks a lot!
  Gilberto</p>