the PRESENT test of an optional variable returns TRUE in both of these calls

$ cat c.F; gfortran c.F ; ./a.out
      PROGRAM MAIN
      REAL A
      INTEGER I
      CALL SUB(A,I)
      CALL SUB(A)
      END

      SUBROUTINE SUB(A,I)
      REAL :: A
      INTEGER, OPTIONAL :: I
      IF (PRESENT(I)) THEN
         PRINT *,'YES'
      ELSE
         PRINT *,'NO'
      END IF
      END
 YES
 YES

c.f intel gives
$ ifort c.F ; ./a.out
 YES
 NO

gfortran behaves correctly with an explicit INTERFACE, but that
should not be required (as far as I know)

Olav


-- 
           Summary: present returns wrong value of optional variables
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vahtras at pdc dot kth dot se
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to