------- Comment #8 from burnus at gcc dot gnu dot org  2010-07-20 15:26 -------
Reduced test case (of allocatable_scalar_4.f90) - fails with "ERROR STOP 1":

program test
  implicit none
  integer, allocatable :: b
  allocate(b)
  b = 7482
  call checkOptional(.false.,.true., 7482)
  call checkOptional(.true., .true., 7482, b)
  if (b /= 46) error stop 1
contains
  subroutine checkOptional(prsnt, alloc, val, x)
    logical, intent(in) :: prsnt, alloc
    integer, allocatable, optional :: x
    integer, intent(in) :: val
    if (present(x)) then
      if (allocated(x) .neqv. alloc) error stop 2
    end if
    if (present(x)) then
      if (allocated(x)) then
        if (x /= val) error stop 3
      end if
    end if
    if (present(x)) then
      x = 46
    end if
  end subroutine checkOptional
end program test


-- 


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

Reply via email to