This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Optional allocatable arrays


Hello,

The following code causes a bus error when run, if compiled with either gfortran 4.2 or 4.4 (haven't tried other versions). I have no problems with g95 or ifort, so am wondering if this is a gfortran bug?

module test_module

  implicit none
  save

contains

  subroutine sub2(a)
    implicit none
    real,allocatable,intent(out),optional :: a(:)
    print *,'in sub2'
  end subroutine sub2

  subroutine sub1(a)
    implicit none
    real,allocatable,intent(out),optional :: a(:)
    print *,'in sub1'
    call sub2(a)
  end subroutine sub1

end module test_module

program test
  use test_module
  implicit none
  call sub1()
end program

The error is:

tom$ ./a.out
 in sub1
Bus error

Should this be reported as a bug? Can other users reproduce this bug?

Thanks for any help,

Thomas



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]