The following is legal (see 
<[EMAIL PROTECTED]>), but we segfault
on execution:

$ cat size.f90
module foo
contains
  subroutine checkv(ires,a1,opt1)
    integer :: a1(:,:)
    integer, optional :: opt1

    ires = size (a1, dim=opt1)
  end subroutine checkv
end module foo

program main
  use foo
  implicit none
  integer :: a(2,3)
  integer :: ires

  call checkv (ires, a)
  print *,ires
  call checkv (ires, a, 1)
  print *,ires
end program main
$ gfortran size.f90
$ ./a.out
Segmentation fault


-- 
           Summary: optional argument passed on to size(...,dim=)
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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

Reply via email to