This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Optional allocatable arrays
- From: Thomas Robitaille <thomas dot robitaille at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Date: Tue, 27 Oct 2009 11:12:37 -0400
- Subject: 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