------- Comment #5 from steven at gcc dot gnu dot org  2006-07-21 23:34 -------
Lahey agrees that this is invalid code:

          1        program test_string_present
          2        
          3            call test_present(1, "foo")
          4            call test_present(2)
          5        
          6        end program
          7        
          8        subroutine test_present(a, b)
          9            integer :: a
         10            character*(*), optional :: b
         11        
         12     1      if (present(b)) then
         13     1          write (0,*) "b is present."
         14     1      else
         15     1          write (0,*) "b is not present."
         16     1      end if
         17        
         18        end subroutine test_present


line 8: Dummy argument 'a' not used in this subprogram.
line 8: The previously procedure 'test_present' reference in 'line 3' shall
have the explicit interface, because that has the optional argument 'b'.
line 8: The argument number of procedure 'test_present' shall be the same
between definition and reference. The previous appearance is in 'line 4'.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid


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

Reply via email to